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.
- Disclaimer: The creator of 'C# Shell (C# Offline Compiler)' is in no way responsible for the code posted by any user.
- using System;
- using System.IO;
- using System.Linq;
- using System.Collections.Generic;
- namespace CSharp_Shell
- {
- public static class Program
- {
- public static void Main()
- {
- int[] arr = Console.ReadLine()
- .Split()
- .Select(int.Parse)
- .ToArray();
- int leftSum = 0;
- int rigthSum = 0;
- for(int i = 0;i<arr.Length;i++)
- {
- rigthSum += arr[i];
- }
- for(int i=0;i<arr.Length;i++)
- {
- rigthSum -=arr[i];
- if(rigthSum == leftSum)
- {
- Console.WriteLine(i);
- return;
- //continue;
- //break;
- }
- leftSum+=arr[i];
- }
- Console.WriteLine("no");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement