Advertisement
fbinnzhivko

Untitled

Jun 13th, 2016
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.75 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4.  
  5. class Z1
  6. {
  7.     static void Main()
  8.     {
  9.  
  10.         double[] array = Console.ReadLine().Split().Select(double.Parse).ToArray();
  11.        
  12.         double average = array.Average();
  13.  
  14.         double[] asa = array.Where(a => a > average).OrderByDescending(x => x).ToArray();
  15.        
  16.         List<double> same = asa.ToList();
  17.         bool result = same.All(item => item == 1);
  18.        
  19.         if (result) { Console.WriteLine("No"); }
  20.         if (asa.Length >= 5)
  21.         {
  22.             double[] x = asa.Take(5).ToArray();
  23.  
  24.             Console.WriteLine(string.Join(" ", x));
  25.         }
  26.         else
  27.         {
  28.             Console.WriteLine(string.Join(" ", asa));
  29.         }
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement