Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- class BiggestTriple
- {
- static void Main()
- {
- int[] myArr = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
- int bestSum = 0;
- int index = 0;
- int steps = 0;
- for (int i = 0; i < myArr.Length; i += 3)
- {
- int tempSum = 0;
- int nextIndexes = i + 3;
- int stepCounter = 0;
- for (int t = i; t < (3 + i) && (t < myArr.Length); t++)
- {
- tempSum += myArr[t];
- stepCounter++;
- }
- if (tempSum > bestSum)
- {
- index = i;
- steps = stepCounter;
- bestSum = tempSum;
- }
- }
- int[] output = new int[steps];
- for (int i = 0; i < steps; i++)
- {
- output[i] = myArr[index + i];
- }
- Console.WriteLine(string.Join(" ", output));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement