| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -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(); | 
					 | 
					 | 
					 | 
					                WriteLine(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            } | 
					 | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -65,16 +65,32 @@ namespace komvo | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            int[] routes = new int[Fact(Points.Count - 1)]; | 
					 | 
					 | 
					 | 
					            int[] routes = new int[Fact(Points.Count - 1)]; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            double[] leng = new double[Fact(Points.Count - 1)]; | 
					 | 
					 | 
					 | 
					            double[] leng = new double[Fact(Points.Count - 1)]; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            int begin = int.Parse(formP), end = int.Parse(formN); | 
					 | 
					 | 
					 | 
					            int waves = 0; | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            for (int b = begin; b <= 234; b++) | 
					 | 
					 | 
					 | 
					            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(); | 
					 | 
					 | 
					 | 
					                for(int j = 0; j < 6; j++) | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                routes[0] = int.Parse(number); | 
					 | 
					 | 
					 | 
					                { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                routes[1] = int.Parse(Swap(number, 1, 2)); | 
					 | 
					 | 
					 | 
					                    if (i == 0 && j == 0) routes[j + i * 6] = int.Parse(formP); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                routes[2] = int.Parse(number = Swap(number, 0, 1)); | 
					 | 
					 | 
					 | 
					                    else if (j % 2 == 0) routes[j + i * 6] = int.Parse(formP = Swap(formP, 0, j / 2)); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                routes[3] = int.Parse(Swap(number, 1, 2)); | 
					 | 
					 | 
					 | 
					                    else routes[j + i * 6] = int.Parse(Swap(formP, 1, 2)); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                routes[4] = int.Parse(number = Swap(number, 0, 2)); | 
					 | 
					 | 
					 | 
					                } | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                routes[5] = int.Parse(Swap(number, 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; | 
					 | 
					 | 
					 | 
					                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()); | 
					 | 
					 | 
					 | 
					            //MessageBox.Show(Math.Sqrt(-1).ToString()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            ReadKey(); | 
					 | 
					 | 
					 | 
					            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 partial struct point | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        { | 
					 | 
					 | 
					 | 
					        { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            public int X { get; set; } | 
					 | 
					 | 
					 | 
					            public int X { get; set; } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            public int Y { get; set; } | 
					 | 
					 | 
					 | 
					            public int Y { get; set; } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        static int Fact(int a) => a <= 1 ? 1 : a * Fact(a - 1); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					} | 
					 | 
					 | 
					 | 
					} |