-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
286 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 16 | ||
VisualStudioVersion = 16.0.30907.101 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OperateInts", "OperateInts\OperateInts.csproj", "{9D7AC370-5119-4D65-8392-264715BD8302}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{9D7AC370-5119-4D65-8392-264715BD8302}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{9D7AC370-5119-4D65-8392-264715BD8302}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{9D7AC370-5119-4D65-8392-264715BD8302}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{9D7AC370-5119-4D65-8392-264715BD8302}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {243487E3-6687-4915-9B5F-68A8E6246AFA} | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>netcoreapp3.1</TargetFramework> | ||
</PropertyGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
using System; | ||
|
||
namespace OperateInts | ||
{ | ||
class Program | ||
{ | ||
static void Main(string[] args) | ||
{ | ||
Console.WriteLine("Please input a set of numbers,split each number with a spacing"); | ||
string s = Console.ReadLine(); | ||
string[] ss = s.Split(" "); | ||
int[] nums = new int[ss.Length]; | ||
int i = 0; | ||
foreach(string sss in ss) | ||
{ | ||
nums[i] = Int32.Parse(sss); | ||
i++; | ||
} | ||
for (int x = 0; x < i-1; x++) | ||
{ | ||
for (int j = 0; j < i-x-1; j++) | ||
{ | ||
if (nums[j] > nums[j + 1]) | ||
{ | ||
int temp = nums[j + 1]; | ||
nums[j + 1] = nums[j]; | ||
nums[j] = temp; | ||
} | ||
} | ||
} | ||
Console.WriteLine($"the biggest number of this set is {nums[i-1]}"); | ||
Console.WriteLine($"the smallest number of this set is {nums[0]}"); | ||
double res = 0; | ||
foreach(int a in nums) | ||
{ | ||
res += a; | ||
} | ||
Console.WriteLine($"their sum is {res}"); | ||
Console.WriteLine($"their average is {res / (i)}"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 16 | ||
VisualStudioVersion = 16.0.30907.101 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PrimeFactor", "PrimeFactor\PrimeFactor.csproj", "{87DD434A-7C6E-4F87-9C8C-ADE56C87D028}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{87DD434A-7C6E-4F87-9C8C-ADE56C87D028}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{87DD434A-7C6E-4F87-9C8C-ADE56C87D028}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{87DD434A-7C6E-4F87-9C8C-ADE56C87D028}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{87DD434A-7C6E-4F87-9C8C-ADE56C87D028}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {3464112D-1EFD-428B-A3B9-C8936DF9DB1E} | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>netcoreapp3.1</TargetFramework> | ||
</PropertyGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using System; | ||
|
||
namespace PrimeFactor | ||
{ | ||
class Program | ||
{ | ||
static void Main(string[] args) | ||
{ | ||
Console.WriteLine("Please input a number"); | ||
string s = Console.ReadLine(); | ||
int Multiple = Int32.Parse(s); | ||
if (Multiple < 2) | ||
Console.WriteLine("it doesn't have a prime factor."); | ||
for(int i=2;Multiple>=i ;i++) | ||
{ | ||
int j = 0; | ||
while(Multiple%i==0) | ||
{ | ||
Multiple /= i; | ||
if (j == 0) | ||
{ | ||
Console.WriteLine($"{i} is its prime factor"); | ||
j++; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 16 | ||
VisualStudioVersion = 16.0.30907.101 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PrimeNumber", "PrimeNumber\PrimeNumber.csproj", "{1AD9D4C6-8205-45E8-AC93-738E3980B087}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{1AD9D4C6-8205-45E8-AC93-738E3980B087}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{1AD9D4C6-8205-45E8-AC93-738E3980B087}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{1AD9D4C6-8205-45E8-AC93-738E3980B087}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{1AD9D4C6-8205-45E8-AC93-738E3980B087}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {58D6B343-2385-482E-AFEE-EEB5D9FE5C08} | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>netcoreapp3.1</TargetFramework> | ||
</PropertyGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using System; | ||
|
||
namespace PrimeNumber | ||
{ | ||
class Program | ||
{ | ||
static void Main(string[] args) | ||
{ | ||
bool[] nums = new bool[101] ; | ||
for(int i=2;i<101;i++) | ||
{ | ||
nums[i] = true; | ||
} | ||
for(int i = 2; i < 101; i++) | ||
{ | ||
for (int j = 2; i * j < 101; j++) | ||
{ | ||
nums[i * j] = false; | ||
} | ||
} | ||
Console.WriteLine("the prime numbers are:"); | ||
for(int i = 2; i < 101; i++) | ||
{ | ||
if (nums[i]) | ||
{ | ||
Console.Write($"{i} "); | ||
} | ||
} | ||
|
||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 16 | ||
VisualStudioVersion = 16.0.30907.101 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ToeplitzMatrix", "ToeplitzMatrix\ToeplitzMatrix.csproj", "{A35432DF-92B4-4C67-930F-43814203E7A4}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{A35432DF-92B4-4C67-930F-43814203E7A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{A35432DF-92B4-4C67-930F-43814203E7A4}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{A35432DF-92B4-4C67-930F-43814203E7A4}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{A35432DF-92B4-4C67-930F-43814203E7A4}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {643E1353-E461-4467-B960-24AA61A94051} | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
using System; | ||
|
||
namespace ToeplitzMatrix | ||
{ | ||
class Program | ||
{ | ||
static void Main(string[] args) | ||
{ | ||
Console.WriteLine("please input the matrix's line"); | ||
int a = Int32.Parse(Console.ReadLine()); | ||
Console.WriteLine("please input the matrix's raw"); | ||
int b = Int32.Parse(Console.ReadLine()); | ||
int[,] matrix= new int[a,b]; | ||
Console.WriteLine("Please input a matrix"); | ||
bool bo = true; | ||
for(int i=0;i<a;i++) | ||
{ | ||
string s = Console.ReadLine(); | ||
string[] ss = s.Split(" "); | ||
while (ss.Length != b) | ||
{ | ||
Console.WriteLine("input error"); | ||
if (ss.Length > b) | ||
{ | ||
Console.WriteLine("We will get rid of redundant numbers"); | ||
break; | ||
} | ||
if (ss.Length < b) | ||
{ | ||
Console.WriteLine("Please input enough numbers"); | ||
s += Console.ReadLine(); | ||
ss = s.Split(" "); | ||
} | ||
} | ||
for(int j=0;j<b;j++) | ||
{ | ||
matrix[i, j] = Int32.Parse(ss[j]); | ||
} | ||
} | ||
for(int i=0;i+1<a&&i+1<b;i++) | ||
{ | ||
if (matrix[i, i] != matrix[i + 1, i + 1]) | ||
{ | ||
bo = false; | ||
break; | ||
} | ||
} | ||
Console.WriteLine(bo.ToString()); | ||
} | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
Homework2/ToeplitzMatrix/ToeplitzMatrix/ToeplitzMatrix.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>netcoreapp3.1</TargetFramework> | ||
</PropertyGroup> | ||
|
||
</Project> |