|
|
back to boardMy succesfull C# code!!! using System; static class Module1 { public static void Main() { short n = short.Parse(Console.ReadLine()); string[] a = Console.ReadLine().Split(); int i = 0; int temp = 0; int max = 0; int numb = 0; while (i + 3 <= n) { temp = int.Parse(a[i]) + int.Parse(a[i + 1]) + int.Parse(a[i + 2]); if (temp > max) { max = temp; numb = i + 2; } i += 1; } Console.WriteLine(max + " " + numb); } } |
|
|