Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace tESt
- {
- class Program
- {
- static void Main(string[] args)
- {
- var n = int.Parse(Console.ReadLine());
- var lastPair = 0;
- var maxDiff = 0;
- for (int i = 0; i < n; i++)
- {
- var num1 = int.Parse(Console.ReadLine());
- var num2 = int.Parse(Console.ReadLine());
- var curentPair = num1 + num2;
- if (i > 0)
- {
- if (lastPair != curentPair)
- {
- var diff = Math.Abs(curentPair - lastPair);
- if (diff > maxDiff)
- {
- maxDiff = diff;
- }
- }
- }
- lastPair = curentPair;
- }
- if (maxDiff == 0)
- {
- Console.WriteLine($"Yes, value={lastPair}");
- }
- else
- {
- Console.WriteLine($"No, maxdiff={maxDiff}");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement