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 @byte
- {
- class Program
- {
- static void Main(string[] args)
- {
- int countOfRepeats = int.Parse(Console.ReadLine());
- int currentSum = 0;
- int previousSum = 0;
- int maxDifference = 0;
- for (int currentRepeat = 0; currentRepeat < countOfRepeats; currentRepeat++)
- {
- previousSum = currentSum;
- int firstNumber = int.Parse(Console.ReadLine());
- int secondNumber = int.Parse(Console.ReadLine());
- currentSum = firstNumber + secondNumber;
- int difference = Math.Abs(currentSum - previousSum);
- if (currentRepeat >= 1 && difference > maxDifference)
- {
- maxDifference = difference;
- }
- }
- if (maxDifference == 0)
- {
- Console.WriteLine($"Yes, value={currentSum}");
- }
- else
- {
- Console.WriteLine($"No, maxdiff={maxDifference}");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement