commit 9f838be6280cd22fd27ece734d06576e49d5f0b7 Author: suntsev Date: Sat Oct 13 00:54:05 2018 +0300 first commit diff --git a/.vs/comivoyar/v15/.suo b/.vs/comivoyar/v15/.suo new file mode 100644 index 0000000..ed77d7e Binary files /dev/null and b/.vs/comivoyar/v15/.suo differ diff --git a/.vs/comivoyar/v15/Server/sqlite3/db.lock b/.vs/comivoyar/v15/Server/sqlite3/db.lock new file mode 100644 index 0000000..e69de29 diff --git a/.vs/comivoyar/v15/Server/sqlite3/storage.ide b/.vs/comivoyar/v15/Server/sqlite3/storage.ide new file mode 100644 index 0000000..79307ff Binary files /dev/null and b/.vs/comivoyar/v15/Server/sqlite3/storage.ide differ diff --git a/.vs/comivoyar/v15/Server/sqlite3/storage.ide-shm b/.vs/comivoyar/v15/Server/sqlite3/storage.ide-shm new file mode 100644 index 0000000..d57cd63 Binary files /dev/null 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 new file mode 100644 index 0000000..d99a6de Binary files /dev/null and b/.vs/comivoyar/v15/Server/sqlite3/storage.ide-wal differ diff --git a/comivoyar.sln b/comivoyar.sln new file mode 100644 index 0000000..a78085a --- /dev/null +++ b/comivoyar.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27703.2042 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "comivoyar", "comivoyar\comivoyar.csproj", "{00C9BDAB-EE3B-4228-889C-0A2045D183B6}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {00C9BDAB-EE3B-4228-889C-0A2045D183B6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {00C9BDAB-EE3B-4228-889C-0A2045D183B6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {00C9BDAB-EE3B-4228-889C-0A2045D183B6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {00C9BDAB-EE3B-4228-889C-0A2045D183B6}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {6AF20A75-B384-4654-A43E-C0246AC6885E} + EndGlobalSection +EndGlobal diff --git a/comivoyar/App.config b/comivoyar/App.config new file mode 100644 index 0000000..731f6de --- /dev/null +++ b/comivoyar/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/comivoyar/Program.cs b/comivoyar/Program.cs new file mode 100644 index 0000000..b7a2ffa --- /dev/null +++ b/comivoyar/Program.cs @@ -0,0 +1,158 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.IO; +using static System.Console; + +namespace komvo +{ + class Program + { + public static List Points = new List(); + + static void Main(string[] args) + { + string file = "coord.txt"; + + using (StreamReader cr = new StreamReader(file)) + { + string line; + while ((line = cr.ReadLine()) != null) + { + string[] str = line.Split(); + Points.Add(new point { X = int.Parse(str[0]), Y = int.Parse(str[1]) }); + } + } + + int matr = Points.Count; + double[,] Matrix = new double[matr, matr]; + + + foreach (point p in Points) + { + WriteLine("{0} {1}", p.X, p.Y); + } + WriteLine(); + + + for (int i = 0; i < Points.Count; i++) + { + for (int j = i; j < Points.Count - 1; j++) + { + Matrix[i, j + 1] = Math.Sqrt(Math.Pow(Points[j + 1].X - Points[i].X, 2) + Math.Pow(Points[j + 1].Y - Points[i].Y, 2)); + Write("{0} {1} : {2:N2}\t", Points[i].X, Points[j + 1].X, Matrix[i, j]); + } + WriteLine(); + } + + + for (int i = 0; i < 4; i++) + { + for (int j = 0; j < 4; j++) Write("{0:00.00} ", Matrix[i, j]); + WriteLine(); + } + + string formP = string.Empty, formN = string.Empty; + for (int i = 2; i <= Points.Count; i++) formP += i.ToString(); + for (int i = Points.Count; i >= 2; i--) formN += i.ToString(); + WriteLine("{0} {1} {2}", formP, formN, Fact(Points.Count - 1)); + + WriteLine(formP + " " + Swap(formP, 1, 2)); + WriteLine("\n\n"); + + 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++) + { + 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 i = 0; i < Points.Count; i++) + //{ + // for (int j = i; j < Points.Count - 1; j++) + // { + + // } + // //WriteLine(); + //} + } + + + + + + for (int i = 0; i < routes.Length; i++) + { + double res = 0; + char[] ch = routes[i].ToString().ToCharArray(); + for(int j = 0; j < ch.Length; j++) + { + if (j == 0) res += Matrix[0, 1]; + else if (j == ch.Length - 1) + { + res += Matrix[int.Parse(ch[j - 1].ToString()) - 1, int.Parse(ch[j].ToString()) - 1]; + res += Matrix[0, int.Parse(ch[j].ToString()) - 1]; + } + else + { + res += Matrix[int.Parse(ch[j - 1].ToString()) - 1, int.Parse(ch[j].ToString()) - 1]; + } + + } + leng[i] = res; + } + + for (int i = 0; i < leng.Length; i++) WriteLine("{0:N2}", leng[i]); + + + + + + //WriteLine(routes[0]); + //MessageBox.Show(Math.Sqrt(-1).ToString()); + ReadKey(); + + } + + public static string Swap(string value, int first, int second) + { + char[] res = value.ToCharArray(); + res[first] = value[second]; + res[second] = value[first]; + value = new string(res); + + return value; + } + + + 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; } + } + } +} \ No newline at end of file diff --git a/comivoyar/Properties/AssemblyInfo.cs b/comivoyar/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..3ef9a74 --- /dev/null +++ b/comivoyar/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Общие сведения об этой сборке предоставляются следующим набором +// набора атрибутов. Измените значения этих атрибутов, чтобы изменить сведения, +// связанные со сборкой. +[assembly: AssemblyTitle("comivoyar")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Microsoft")] +[assembly: AssemblyProduct("comivoyar")] +[assembly: AssemblyCopyright("Copyright © Microsoft 2018")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Установка значения False для параметра ComVisible делает типы в этой сборке невидимыми +// для компонентов COM. Если необходимо обратиться к типу в этой сборке через +// COM, задайте атрибуту ComVisible значение TRUE для этого типа. +[assembly: ComVisible(false)] + +// Следующий GUID служит для идентификации библиотеки типов, если этот проект будет видимым для COM +[assembly: Guid("00c9bdab-ee3b-4228-889c-0a2045d183b6")] + +// Сведения о версии сборки состоят из следующих четырех значений: +// +// Основной номер версии +// Дополнительный номер версии +// Номер сборки +// Редакция +// +// Можно задать все значения или принять номер сборки и номер редакции по умолчанию. +// используя "*", как показано ниже: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/comivoyar/bin/Debug/comivoyar.exe b/comivoyar/bin/Debug/comivoyar.exe new file mode 100644 index 0000000..1754b6d Binary files /dev/null and b/comivoyar/bin/Debug/comivoyar.exe differ diff --git a/comivoyar/bin/Debug/comivoyar.exe.config b/comivoyar/bin/Debug/comivoyar.exe.config new file mode 100644 index 0000000..731f6de --- /dev/null +++ b/comivoyar/bin/Debug/comivoyar.exe.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/comivoyar/bin/Debug/comivoyar.pdb b/comivoyar/bin/Debug/comivoyar.pdb new file mode 100644 index 0000000..4e6d5dc Binary files /dev/null and b/comivoyar/bin/Debug/comivoyar.pdb differ diff --git a/comivoyar/bin/Debug/coord.txt b/comivoyar/bin/Debug/coord.txt new file mode 100644 index 0000000..c23245f --- /dev/null +++ b/comivoyar/bin/Debug/coord.txt @@ -0,0 +1,4 @@ +30 40 +20 50 +10 23 +35 32 \ No newline at end of file diff --git a/comivoyar/comivoyar.csproj b/comivoyar/comivoyar.csproj new file mode 100644 index 0000000..c3b400e --- /dev/null +++ b/comivoyar/comivoyar.csproj @@ -0,0 +1,52 @@ + + + + + Debug + AnyCPU + {00C9BDAB-EE3B-4228-889C-0A2045D183B6} + Exe + comivoyar + comivoyar + v4.6.1 + 512 + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/comivoyar/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/comivoyar/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache new file mode 100644 index 0000000..1ba01cc Binary files /dev/null and b/comivoyar/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/comivoyar/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs b/comivoyar/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs new file mode 100644 index 0000000..e69de29 diff --git a/comivoyar/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs b/comivoyar/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs new file mode 100644 index 0000000..e69de29 diff --git a/comivoyar/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs b/comivoyar/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs new file mode 100644 index 0000000..e69de29 diff --git a/comivoyar/obj/Debug/comivoyar.csproj.CoreCompileInputs.cache b/comivoyar/obj/Debug/comivoyar.csproj.CoreCompileInputs.cache new file mode 100644 index 0000000..125c6b5 --- /dev/null +++ b/comivoyar/obj/Debug/comivoyar.csproj.CoreCompileInputs.cache @@ -0,0 +1 @@ +a325577e7d0bb098d5c8871f5acaa6c0c34b21c6 diff --git a/comivoyar/obj/Debug/comivoyar.csproj.FileListAbsolute.txt b/comivoyar/obj/Debug/comivoyar.csproj.FileListAbsolute.txt new file mode 100644 index 0000000..3319c42 --- /dev/null +++ b/comivoyar/obj/Debug/comivoyar.csproj.FileListAbsolute.txt @@ -0,0 +1,7 @@ +E:\кк\прог\comivoyar\comivoyar\bin\Debug\comivoyar.exe.config +E:\кк\прог\comivoyar\comivoyar\bin\Debug\comivoyar.exe +E:\кк\прог\comivoyar\comivoyar\bin\Debug\comivoyar.pdb +E:\кк\прог\comivoyar\comivoyar\obj\Debug\comivoyar.csprojAssemblyReference.cache +E:\кк\прог\comivoyar\comivoyar\obj\Debug\comivoyar.csproj.CoreCompileInputs.cache +E:\кк\прог\comivoyar\comivoyar\obj\Debug\comivoyar.exe +E:\кк\прог\comivoyar\comivoyar\obj\Debug\comivoyar.pdb diff --git a/comivoyar/obj/Debug/comivoyar.csprojAssemblyReference.cache b/comivoyar/obj/Debug/comivoyar.csprojAssemblyReference.cache new file mode 100644 index 0000000..51e185e Binary files /dev/null and b/comivoyar/obj/Debug/comivoyar.csprojAssemblyReference.cache differ diff --git a/comivoyar/obj/Debug/comivoyar.exe b/comivoyar/obj/Debug/comivoyar.exe new file mode 100644 index 0000000..1754b6d Binary files /dev/null and b/comivoyar/obj/Debug/comivoyar.exe differ diff --git a/comivoyar/obj/Debug/comivoyar.pdb b/comivoyar/obj/Debug/comivoyar.pdb new file mode 100644 index 0000000..4e6d5dc Binary files /dev/null and b/comivoyar/obj/Debug/comivoyar.pdb differ