|
|
вернуться в форумтест 6 Please help pass the test 6. It is very necessary. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace _1910 { class Program { static void Main(string[] args) { string str = Console.ReadLine(); int n = int.Parse(str); string[] mas = Console.ReadLine().Split(' '); int[] a=new int[n]; for (int i=0; i<n; i++) a[i]=int.Parse(mas[i]); int sum=0, j=0, maxsum=0; if (n >= 3) { for (int i = 0; i < n - 2; i++) { if ((a[i] == a[i + 1]) && (a[i] == a[i + 2])) { sum = a[i]*3; j = i + 2; } if (sum > maxsum) { maxsum = sum; sum = 0; } } } Console.WriteLine(maxsum + " " + j); } } } |
|
|