Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- class InstructionSet_broken
- {
- static void Main()
- {
- int[] arr = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
- int arrsum = 0;
- bool isFound = false;
- if (arr.Length == 1)
- {
- Console.WriteLine("0");
- }
- else
- {
- for (int i = 0; i < arr.Length; i++)
- {
- arrsum += arr[i];
- int sum = 0;
- if (i == arr.Length-1 )
- {
- break;
- }
- for (int j = arr.Length - 1; j >= 0; j--)
- {
- sum += arr[j];
- if (arrsum == sum)
- {
- Console.WriteLine(i + 1);
- isFound = true;
- break;
- }
- else if (arrsum < sum)
- {
- break;
- }
- if (isFound)
- {
- break;
- }
- }
- }
- if (!isFound)
- {
- Console.WriteLine("no");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement