Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- namespace EcualSum
- {
- class Program
- {
- static void Main(string[] args)
- {
- int[] array = Console
- .ReadLine()
- .Split()
- .Select(int.Parse)
- .ToArray();
- int leftSum = 0;
- int rightSum = 0;
- int counter = 0;
- if (array.Length == 1)
- {
- Console.WriteLine(0);
- return;
- }
- for (int i = 0; i < array.Length - 1; i++)
- {
- leftSum += array[i];
- counter++;
- for (int u = i + 2; u < array.Length; u++)
- {
- rightSum += array[u];
- if (rightSum > leftSum)
- {
- break;
- }
- }
- if (leftSum == rightSum)
- {
- Console.WriteLine(counter);
- return;
- }
- else
- {
- rightSum = 0;
- }
- }
- Console.WriteLine("no");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement