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