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 l=0;
- int r=0;
- int mitte=-1;
- for(int i = 0;i < a.Length;i++)
- {
- mitte = a[i];
- for(int j=i;j<a.Length-1;j++)
- {
- if(mitte>=a.Length-1)
- {
- r=0;
- }
- else
- {
- r+=a[j+1];
- }
- }
- for(int k=a[i];k>=0;k--)
- {
- if(mitte<=a[i])
- {
- l=0;
- }
- else{
- l+=a[k+1];
- }
- }
- }
- if(l==r)
- {
- Console.Write(mitte);
- }
- else{
- Console.Write("no");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement