Advertisement
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 pairs
- {
- class Program
- {
- static void Main(string[] args)
- {
- var number = double.Parse(Console.ReadLine());
- double sum = 0;
- double sum2 = 0;
- double max = 0;
- double avg = 0;
- for (int i = 1; i <= number; i++)
- {
- sum2 = sum;
- var a = double.Parse(Console.ReadLine());
- var b = double.Parse(Console.ReadLine());
- sum = a + b;
- if (i == 1)
- {
- continue;
- }
- avg = Math.Abs(sum - sum2);
- if (avg > max)
- {
- max = avg;
- }
- }
- if (max == 0)
- {
- Console.WriteLine("Yes, value={0}", sum);
- }
- else
- {
- Console.WriteLine("No, maxdiff={0}",max);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement