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 ConsoleApplication1
- {
- class Program
- {
- static void Main(string[] args)
- {
- string sequence = Console.ReadLine();
- string[] array = sequence.Split(' ');
- List<int> sum = new List<int>();
- for (int i = 0; i < (array.Length); i += 2)
- {
- int x = Convert.ToInt32(array[i]);
- int y = Convert.ToInt32(array[i + 1]);
- int sumXandY = x + y;
- sum.Add(sumXandY);
- }
- int max = sum.Max();
- if (max == (sum.Min()))
- {
- Console.WriteLine("Yes, value=" + sum[0]);
- }
- else
- {
- Console.WriteLine("No, maxdiff=" + (max - sum.Min()));
- }
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement