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 a = 0;
- double b = 0;
- double sum = 0;
- double tempMin = 0;
- double temp2 = 0;
- double sum2 = 0;
- double max = 0;
- double avg = 0;
- for (int i = 1; i <= number; i++)
- {
- a = double.Parse(Console.ReadLine());
- b = double.Parse(Console.ReadLine());
- sum = a + b;
- sum2 += sum;
- if (i == 1)
- {
- tempMin = sum;
- temp2 = sum;
- }
- if (tempMin > sum)
- {
- tempMin = sum;
- }
- else if (temp2 < sum)
- {
- temp2 = sum;
- }
- max = temp2 - tempMin;
- avg = max;
- if (max < avg)
- {
- max = avg;
- }
- }
- if ((sum2 / number) == sum)
- {
- Console.WriteLine("Yes, value={0}", sum);
- }
- else
- {
- Console.WriteLine("No, maxdiff={0}",max);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement