|
|
@ -1,9 +1,9 @@ |
|
|
|
using System; |
|
|
|
using System; |
|
|
|
using System.IO; |
|
|
|
|
|
|
|
using System.Diagnostics; |
|
|
|
using System.Diagnostics; |
|
|
|
using Combinatorics.Collections; |
|
|
|
using Combinatorics.Collections; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Collections.Generic; |
|
|
|
using static System.Console; |
|
|
|
using static System.Console; |
|
|
|
|
|
|
|
using System.Threading.Tasks; |
|
|
|
|
|
|
|
|
|
|
|
namespace komvo |
|
|
|
namespace komvo |
|
|
|
{ |
|
|
|
{ |
|
|
@ -15,9 +15,19 @@ namespace komvo |
|
|
|
|
|
|
|
|
|
|
|
List<Point> Points = new List<Point>(); |
|
|
|
List<Point> Points = new List<Point>(); |
|
|
|
Random random = new Random(); |
|
|
|
Random random = new Random(); |
|
|
|
int pCount; |
|
|
|
int pCount = 0; |
|
|
|
Write("Введите количество точек: "); |
|
|
|
Write("Введите количество точек: "); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Retry: |
|
|
|
|
|
|
|
try |
|
|
|
|
|
|
|
{ |
|
|
|
pCount = Convert.ToInt32(ReadLine()); |
|
|
|
pCount = Convert.ToInt32(ReadLine()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
catch |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Write("Введите натуральное число: "); |
|
|
|
|
|
|
|
goto Retry; |
|
|
|
|
|
|
|
} |
|
|
|
Stopwatch stopwatch = new Stopwatch(); |
|
|
|
Stopwatch stopwatch = new Stopwatch(); |
|
|
|
stopwatch.Start(); |
|
|
|
stopwatch.Start(); |
|
|
|
|
|
|
|
|
|
|
@ -44,10 +54,8 @@ namespace komvo |
|
|
|
for (int j = 0; j < matr; j++) Write("{0:00.00} ", Matrix[i, j]); |
|
|
|
for (int j = 0; j < matr; j++) Write("{0:00.00} ", Matrix[i, j]); |
|
|
|
WriteLine(); |
|
|
|
WriteLine(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int[] toSwap = new int[Points.Count - 1]; |
|
|
|
int[] toSwap = new int[Points.Count - 1]; |
|
|
|
for (int i = 0; i <= toSwap.Length - 1; i++) toSwap[i] = i + 2; |
|
|
|
for (int i = 0; i <= toSwap.Length - 1; i++) toSwap[i] = i + 2; |
|
|
|
//for (int i = 0; i < toSwap.Length; i++) Write(toSwap[i]); //debug |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int index = 0; |
|
|
|
int index = 0; |
|
|
|
double opLength = 0, prevResult = 0; |
|
|
|
double opLength = 0, prevResult = 0; |
|
|
@ -78,10 +86,11 @@ namespace komvo |
|
|
|
stopwatch.Stop(); |
|
|
|
stopwatch.Stop(); |
|
|
|
|
|
|
|
|
|
|
|
Write("Ещё раз? (y/n)"); |
|
|
|
Write("Ещё раз? (y/n)"); |
|
|
|
char answer = Convert.ToChar(ReadLine()); |
|
|
|
char answer = ReadKey().KeyChar; |
|
|
|
if (answer == 'y') |
|
|
|
if (answer == 'y') |
|
|
|
{ |
|
|
|
{ |
|
|
|
Points.Clear(); |
|
|
|
Points.Clear(); |
|
|
|
|
|
|
|
WriteLine("\n"); |
|
|
|
goto Beginig; |
|
|
|
goto Beginig; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -93,8 +102,6 @@ namespace komvo |
|
|
|
|
|
|
|
|
|
|
|
for (int j = 0; j < index.Length - 1; j++) |
|
|
|
for (int j = 0; j < index.Length - 1; j++) |
|
|
|
{ |
|
|
|
{ |
|
|
|
string dg = index[j]; |
|
|
|
|
|
|
|
int db = int.Parse(index[j]) - 2; //debug |
|
|
|
|
|
|
|
if (j == 0) result += mtr[0, int.Parse(index[j]) - 1]; |
|
|
|
if (j == 0) result += mtr[0, int.Parse(index[j]) - 1]; |
|
|
|
else if (j == index.Length - 1) |
|
|
|
else if (j == index.Length - 1) |
|
|
|
{ |
|
|
|
{ |
|
|
|