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 EqualPairs
- {
- class Program
- {
- static void Main(string[] args)
- {
- int N = int.Parse(Console.ReadLine());
- int currentSum = 0;
- int previousSum = 0;
- int diff = 0;
- int maxDiff = 0;
- for (int i = 0; i < N; i++)
- {
- previousSum = currentSum;
- currentSum = 0;
- for (int j = 1; j <= 2;j++)
- {
- currentSum += int.Parse(Console.ReadLine());
- }
- if (i != 0) // този if няма да се изпълни при първото завъртане на for i
- {
- diff = Math.Abs(currentSum - previousSum);
- if (diff != 0 && diff > maxDiff)
- {
- maxDiff = diff;
- }
- }
- }
- if (maxDiff == 0 || N == 1)
- {
- Console.WriteLine("Yes, value= {0}", currentSum);
- }
- else
- {
- Console.WriteLine("No, maxDiff= {0}", maxDiff);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment