Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace LiveDemo
- {
- class Program
- {
- static void Main(string[] args)
- {
- int n = int.Parse(Console.ReadLine());
- int firstSum = 0;
- int secondSum = 0;
- int i = 0;
- int maxDifference = 0;
- while(i<n)
- {
- secondSum = firstSum;
- int num = int.Parse(Console.ReadLine());
- int num2 = int.Parse(Console.ReadLine());
- firstSum = num + num2;
- if (i>0)
- {
- if(firstSum!=secondSum)
- {
- maxDifference = Math.Abs(firstSum - secondSum);
- }
- }
- i++;
- }
- if(firstSum==secondSum||n==1)
- {
- Console.WriteLine("Yes, value={0}",firstSum);
- }
- else
- {
- Console.WriteLine("No, maxdiff={0}",maxDifference);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment