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 _12.EqualSums
- {
- class Program
- {
- static void Main(string[] args)
- {
- //
- int[] nums = Console.ReadLine().Split().Select(int.Parse).ToArray();
- // int[] nums = new int[] {1, 2, 3, 3};
- bool areEqual = false;
- for (int current = 0; current < nums.Length; current++)
- {
- int sumLeft = 0;
- int sumRight = 0;
- for (int curr = 0; curr < current+1; curr++)
- {
- sumLeft += nums[curr];
- }
- for (int i = nums.Length - 1; i >= current; i--)
- {
- sumRight += nums[i];
- }
- if (sumLeft==sumRight)
- {
- Console.WriteLine(current);
- areEqual = true;
- }
- }
- if (!areEqual)
- {
- Console.WriteLine("no");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement