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 Equal_Pairs
- {
- class Equal_Pairs
- {
- static void Main(string[] args)
- {
- int Sum = 0;
- int NextSum = 0;
- int Difference = 1;
- int MaxDifference = 0;
- int n = int.Parse(Console.ReadLine());
- for (int i = 1; i <= n; i++)
- {
- Sum = NextSum;
- int number1 = int.Parse(Console.ReadLine());
- int number2 = int.Parse(Console.ReadLine());
- NextSum = (number1 + number2);
- Difference = Math.Abs(NextSum - Sum);
- if ((Difference > MaxDifference) && (i >= 2)) MaxDifference = Difference;
- }
- if (MaxDifference == 0) Console.WriteLine("Yes, value " + NextSum);
- else Console.WriteLine("No, maxdiff " + MaxDifference);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment