Advertisement
Spocoman

03. Numbers

Nov 7th, 2023
758
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.50 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3. using System.Collections.Generic;
  4.  
  5. namespace Numbers
  6. {
  7.     class Program
  8.     {
  9.         static void Main(string[] args)
  10.         {
  11.             var numbers = Console.ReadLine().Split(' ').Select(int.Parse).OrderByDescending(n => n).ToList();
  12.             var top5 = numbers.Where(n => n > numbers.Sum() / numbers.Count).ToList();
  13.  
  14.             Console.WriteLine(top5.Count == 0 ? "No" : String.Join(' ', top5.Count > 5 ? top5.GetRange(0, 5) : top5));
  15.         }
  16.     }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement