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 a = 0, b = 0, c = 0, same = 0;
- int minA = int.MaxValue , maxA = int.MinValue ,lastA = 0;
- for (int i = 0; i < pairs; i++)
- {
- int firstNumb = int.Parse(Console.ReadLine());
- a += firstNumb;
- for (int ii = 0; ii < 1; ii++)
- {
- int secondNumb = int.Parse(Console.ReadLine());
- a += secondNumb;
- }
- if (i == 0) { b = a ; }
- if (b == a) { same++; }
- c = Math.Abs(lastA - a);
- lastA = a;
- if (c > maxDif && i != 0) { maxDif = c; }
- a = 0;
- }
- if (pairs == same )
- {
- Console.WriteLine($"Yes, value={b}");
- }
- else
- {
- Console.WriteLine($"No, maxdiff={maxDif}");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement