diff --git a/.vs/comivoyar/v15/.suo b/.vs/comivoyar/v15/.suo index ed77d7e..23797c2 100644 Binary files a/.vs/comivoyar/v15/.suo and b/.vs/comivoyar/v15/.suo differ diff --git a/.vs/comivoyar/v15/Server/sqlite3/storage.ide-shm b/.vs/comivoyar/v15/Server/sqlite3/storage.ide-shm index d57cd63..bece3a3 100644 Binary files a/.vs/comivoyar/v15/Server/sqlite3/storage.ide-shm and b/.vs/comivoyar/v15/Server/sqlite3/storage.ide-shm differ diff --git a/.vs/comivoyar/v15/Server/sqlite3/storage.ide-wal b/.vs/comivoyar/v15/Server/sqlite3/storage.ide-wal index d99a6de..30e667d 100644 Binary files a/.vs/comivoyar/v15/Server/sqlite3/storage.ide-wal and b/.vs/comivoyar/v15/Server/sqlite3/storage.ide-wal differ diff --git a/1.bmp b/1.bmp new file mode 100644 index 0000000..1fcac58 Binary files /dev/null and b/1.bmp differ diff --git a/comivoyar/Program.cs b/comivoyar/Program.cs index b7a2ffa..3a9e2cc 100644 --- a/comivoyar/Program.cs +++ b/comivoyar/Program.cs @@ -48,9 +48,9 @@ namespace komvo } - for (int i = 0; i < 4; i++) + for (int i = 0; i < matr; i++) { - for (int j = 0; j < 4; j++) Write("{0:00.00} ", Matrix[i, j]); + for (int j = 0; j < matr; j++) Write("{0:00.00} ", Matrix[i, j]); WriteLine(); } @@ -65,16 +65,32 @@ namespace komvo int[] routes = new int[Fact(Points.Count - 1)]; double[] leng = new double[Fact(Points.Count - 1)]; - int begin = int.Parse(formP), end = int.Parse(formN); - for (int b = begin; b <= 234; b++) + int waves = 0; + if (Points.Count == 4) waves = 1; + else if (Points.Count == 5) waves = 4; + else if (Points.Count == 6) waves = 20; + + + string inf = formP; + for (int i = 0; i < waves; i++) { - string number = b.ToString(); - routes[0] = int.Parse(number); - routes[1] = int.Parse(Swap(number, 1, 2)); - routes[2] = int.Parse(number = Swap(number, 0, 1)); - routes[3] = int.Parse(Swap(number, 1, 2)); - routes[4] = int.Parse(number = Swap(number, 0, 2)); - routes[5] = int.Parse(Swap(number, 1, 2)); + for(int j = 0; j < 6; j++) + { + if (i == 0 && j == 0) routes[j + i * 6] = int.Parse(formP); + else if (j % 2 == 0) routes[j + i * 6] = int.Parse(formP = Swap(formP, 0, j / 2)); + else routes[j + i * 6] = int.Parse(Swap(formP, 1, 2)); + } + if (waves > 1) formP = Swap(inf, 0, 3); + + + + + //routes[0] = int.Parse(formP); + //routes[1] = int.Parse(Swap(formP, 1, 2)); + //routes[2] = int.Parse(formP = Swap(formP, 0, 1)); + //routes[3] = int.Parse(Swap(formP, 1, 2)); + //routes[4] = int.Parse(formP = Swap(formP, 0, 2)); + //routes[5] = int.Parse(Swap(formP, 1, 2)); @@ -115,13 +131,24 @@ namespace komvo leng[i] = res; } - for (int i = 0; i < leng.Length; i++) WriteLine("{0:N2}", leng[i]); + double optim = leng[0]; + int oIndex = 0; + for (int i = 0; i < leng.Length; i++) + { + WriteLine("{0:N2}", leng[i]); + if (optim > leng[i]) + { + optim = leng[i]; + oIndex = i; + } + } + WriteLine("1{1}1 - оптимальный маршрут длинной {0:00.00}", optim, routes[oIndex]); - //WriteLine(routes[0]); + //WriteLine(Fact(5)); //MessageBox.Show(Math.Sqrt(-1).ToString()); ReadKey(); @@ -138,21 +165,13 @@ namespace komvo } - static public int Fact(int nm) - { - int res = 1; - for (int i = 1; i <= nm; i++) - { - res *= i; - } - return res; - } - - public partial struct point { public int X { get; set; } public int Y { get; set; } } + + + static int Fact(int a) => a <= 1 ? 1 : a * Fact(a - 1); } } \ No newline at end of file diff --git a/comivoyar/bin/Debug/comivoyar.exe b/comivoyar/bin/Debug/comivoyar.exe index 1754b6d..7406ac1 100644 Binary files a/comivoyar/bin/Debug/comivoyar.exe and b/comivoyar/bin/Debug/comivoyar.exe differ diff --git a/comivoyar/bin/Debug/comivoyar.pdb b/comivoyar/bin/Debug/comivoyar.pdb index 4e6d5dc..5ecd370 100644 Binary files a/comivoyar/bin/Debug/comivoyar.pdb and b/comivoyar/bin/Debug/comivoyar.pdb differ diff --git a/comivoyar/bin/Debug/coord.txt b/comivoyar/bin/Debug/coord.txt index c23245f..3e08df8 100644 --- a/comivoyar/bin/Debug/coord.txt +++ b/comivoyar/bin/Debug/coord.txt @@ -1,4 +1,5 @@ 30 40 20 50 10 23 -35 32 \ No newline at end of file +35 32 +25 25 \ No newline at end of file diff --git a/comivoyar/obj/Debug/comivoyar.csproj.CoreCompileInputs.cache b/comivoyar/obj/Debug/comivoyar.csproj.CoreCompileInputs.cache index 125c6b5..e4c5453 100644 --- a/comivoyar/obj/Debug/comivoyar.csproj.CoreCompileInputs.cache +++ b/comivoyar/obj/Debug/comivoyar.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -a325577e7d0bb098d5c8871f5acaa6c0c34b21c6 +6eed873852f8ce9c50ebe974dac1f20cc4ef270e diff --git a/comivoyar/obj/Debug/comivoyar.csproj.FileListAbsolute.txt b/comivoyar/obj/Debug/comivoyar.csproj.FileListAbsolute.txt index 3319c42..87e761f 100644 --- a/comivoyar/obj/Debug/comivoyar.csproj.FileListAbsolute.txt +++ b/comivoyar/obj/Debug/comivoyar.csproj.FileListAbsolute.txt @@ -5,3 +5,10 @@ E:\кк\прог\comivoyar\comivoyar\obj\Debug\comivoyar.csprojAssemblyReference E:\кк\прог\comivoyar\comivoyar\obj\Debug\comivoyar.csproj.CoreCompileInputs.cache E:\кк\прог\comivoyar\comivoyar\obj\Debug\comivoyar.exe E:\кк\прог\comivoyar\comivoyar\obj\Debug\comivoyar.pdb +D:\Git\comvo\comivoyar\bin\Debug\comivoyar.exe.config +D:\Git\comvo\comivoyar\bin\Debug\comivoyar.exe +D:\Git\comvo\comivoyar\bin\Debug\comivoyar.pdb +D:\Git\comvo\comivoyar\obj\Debug\comivoyar.csprojAssemblyReference.cache +D:\Git\comvo\comivoyar\obj\Debug\comivoyar.csproj.CoreCompileInputs.cache +D:\Git\comvo\comivoyar\obj\Debug\comivoyar.exe +D:\Git\comvo\comivoyar\obj\Debug\comivoyar.pdb diff --git a/comivoyar/obj/Debug/comivoyar.exe b/comivoyar/obj/Debug/comivoyar.exe index 1754b6d..7406ac1 100644 Binary files a/comivoyar/obj/Debug/comivoyar.exe and b/comivoyar/obj/Debug/comivoyar.exe differ diff --git a/comivoyar/obj/Debug/comivoyar.pdb b/comivoyar/obj/Debug/comivoyar.pdb index 4e6d5dc..5ecd370 100644 Binary files a/comivoyar/obj/Debug/comivoyar.pdb and b/comivoyar/obj/Debug/comivoyar.pdb differ