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