Advertisement
Guest User

Untitled

a guest
May 26th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.67 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3. using System.Collections.Generic;
  4.  
  5. namespace _11_Еxc_EqualSum
  6. {
  7.     class Program
  8.     {
  9.         static void Main(string[] args)
  10.         {
  11.             List<int> arrInput = Console.ReadLine().Split(' ').Select(int.Parse).ToList();
  12.             bool ifExists = true;
  13.             for (int i = 0; i < arrInput.Count(); i++)
  14.             {
  15.                 if (arrInput.Take(i).Sum() == arrInput.Skip(i + 1).Sum())
  16.                 {
  17.                     Console.WriteLine(i);
  18.                     ifExists = false;
  19.                     break;
  20.                 }
  21.             }
  22.             if (ifExists) Console.WriteLine("no");
  23.         }
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement