using System; namespace ConsoleApp2 { class Program { static int readint() { return Convert.ToInt32(Console.ReadLine()); } static void swap(ref string a, ref string b) { string temp = a; a = b; b = temp; } static void Main(string[] args) { /* string[] a = new string[10]; for (int i = 0; i < 10; i++) { a[i] = Console.ReadLine(); } for (int i = 0; i < 10; i++) { for (int e = 0; e < 9; e++) if(a[e].CompareTo(a[e+1]) > 0) swap(ref a[e], ref a[e + 1]); } for (int i = 0; i < 10; i++) { Console.WriteLine(a[i]); } */ int count,i,j; count = readint(); int[,] dist = new int[count,count]; for(i = 0; i < count; i++) for (j = 0; j < count; j++) dist[i,j] = (i == j) ? 0 : 9999; for (int prez = 0; prez < count; prez++) for (int z = 0; z < count; z++) for (int kam = 0; kam < count; kam++) if (dist[z, kam] > dist[z, prez] + dist[prez, kam]) dist[z, kam] = dist[z, prez] + dist[prez, kam]; } } }