Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Disclaimer: The creator of 'C# Shell (C# Offline Compiler)' is in no way responsible for the code posted by any user.
- namespace Program
- {
- using System;
- using System.Linq;
- public class EqualSums
- {
- public static void Main()
- {
- int[] a = Console.ReadLine()
- .Split()
- .Select(int.Parse)
- .ToArray();
- int leftSum=0;
- int rightSum=0;
- for(int i=0; i<a.Length;i++)
- {
- rightSum+=a[i];
- }
- for(int i=0;i<a.Length;i++)
- {
- rightSum-=a[i];
- if(leftSum==rightSum)
- {
- Console.Write(i);
- return;
- }
- leftSum+=a[i];
- }
- Console.Write("no");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement