Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // алтернативно решение с linq библиотеката
- int[] inputArray = Console.ReadLine().Split(" ").Select(int.Parse).ToArray();
- int m = inputArray[0];
- int l = inputArray[1];
- int[] resultArray = new int[l];
- for (int i = 0; i < l; i++)
- {
- int[] array = new int[m];
- int[] input = Console.ReadLine().Split(" ").Select(int.Parse).ToArray();
- for (int j = 0; j < input.Length; j++)
- {
- array[j] = input[j];
- if(j == 0)
- {
- continue;
- }
- else
- {
- array[input.Length - j] = array[j - 1] + array[j];
- }
- }
- resultArray[i] = array.Max();
- }
- Console.WriteLine(resultArray.Max());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement