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 Equal_Pairs
- {
- class Program
- {
- static void Main(string[] args)
- {
- int count = int.Parse(Console.ReadLine());
- double value = 0.0;
- double difference = 0.0;
- for (int i = 1; i <= count; i++)
- {
- double firstNumber = double.Parse(Console.ReadLine());
- double secondNumber = double.Parse(Console.ReadLine());
- if (value != 0)
- {
- difference = Math.Max(difference, Math.Abs(value - (firstNumber + secondNumber)));
- }
- value = firstNumber + secondNumber;
- }
- if (difference == 0)
- {
- Console.WriteLine("Yes, value=" + value);
- }
- else
- {
- Console.WriteLine("No, maxdiff="+difference);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment