Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace EqualSums_27._05._2016
- {
- class Program
- {
- static void Main(string[] args)
- {
- int[] number = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
- int sumLeft = 0;
- int equalIndex = 0;
- for (int i = 0; i <= (number.Length - 1) / 2; i++)
- {
- sumLeft += number[i];
- }
- for (int iReverse = 0; iReverse < number.Length / 2; iReverse++)
- {
- if (number[number.Length - 1 - iReverse] == sumLeft)
- {
- for (int j = number.Length / 2; j < number.Length; j++)
- {
- if (number[j] == sumLeft)
- {
- equalIndex = j;
- break;
- }
- break;
- }
- }
- }
- Print(number, equalIndex);
- }
- static void Print (int[] inputNumbers, int equalIndex)
- {
- if (equalIndex > 0)
- {
- Console.WriteLine(equalIndex);
- }
- else if (equalIndex == 0 && inputNumbers.Length == 1)
- {
- Console.WriteLine(0);
- }
- else if (equalIndex == 0 && inputNumbers.Length > 1)
- {
- Console.WriteLine("no");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement