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 Program
- {
- static void Main(string[] args)
- {
- var n = int.Parse(Console.ReadLine());
- var first = int.Parse(Console.ReadLine());
- var second = int.Parse(Console.ReadLine());
- var sum = first + second;
- var maxDiff = int.MinValue;
- for (int i = 0; i < n - 1; i++)
- {
- var a = int.Parse(Console.ReadLine());
- var b = int.Parse(Console.ReadLine());
- if (sum != a + b)
- {
- var diff = Math.Abs(sum - (a + b));
- if (maxDiff < diff)
- {
- maxDiff = diff;
- }
- sum = a + b;
- }
- }
- if (maxDiff == int.MinValue)
- {
- Console.WriteLine($"Yes, value={sum}");
- }
- else
- {
- Console.WriteLine($"No, maxdiff={maxDiff}");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment