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;
- class Program
- {
- static void Main(string[] args)
- {
- string a = Console.ReadLine();
- string[] spaces = a.Split(' ');
- int[] array = new int[spaces.Length];
- int b = 0;
- for (int i = 0; i < spaces.Length; i++)
- { //0 1 2 3 4 5 6 7
- // 0 1 ; 2 3; 4 5; 67
- array[i] = int.Parse(spaces[i]);
- }
- int[] results = new int[spaces.Length / 2];
- for (int i = 0; i < spaces.Length / 2; i++)
- {
- results[i] = array[i + b] + array[i + b + 1];
- b++;
- }
- for (int i = 0; i < spaces.Length / 2; i++)
- {
- if (results[i] == results.Average())
- {
- Console.WriteLine("Yes, value={0}", results[i]);
- break;
- }
- else
- {
- Console.WriteLine("No, maxdiff={0}", Math.Abs(results.Min() - results.Max()));
- break;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement