Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace MyApp
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- int pairs = int.Parse(Console.ReadLine());
- int maxDif = int.MinValue;
- int intNum = 0, equally = 0, difference = 0, countEqually = 0;
- int lastNum = 0;
- for (int i = 0; i < pairs; i++)
- {
- int firstNumb = int.Parse(Console.ReadLine());
- intNum += firstNumb;
- for (int ii = 0; ii < 1; ii++)
- {
- int secondNumb = int.Parse(Console.ReadLine());
- intNum += secondNumb;
- }
- if (i == 0) { equally = intNum ; }
- if (equally == intNum) { countEqually++; }
- difference = Math.Abs(lastNum - intNum);
- lastNum = intNum;
- if (difference > maxDif && i != 0) { maxDif = difference; }
- intNum = 0;
- }
- if (pairs == countEqually )
- {
- Console.WriteLine($"Yes, value={equally}");
- }
- else
- {
- Console.WriteLine($"No, maxdiff={maxDif}");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement