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 MaxSequenceOfEqualElement
- {
- class MaxSequenceOfEqualElement
- {
- static void Main(string[] args)
- {
- List<int> nums = Console.ReadLine().Split(' ').Select(int.Parse).ToList();
- int[] counts = new int[nums.Max() + 1];
- int equal = 0;
- foreach (var num in nums)
- {
- counts[num]++;
- }
- equal = nums[counts.Max()];
- if (counts.Max() == 1)
- {
- Console.WriteLine($"{nums.First()}");
- }
- else
- {
- for (int i = 0; i < counts.Max(); i++)
- {
- Console.Write($"{equal} ");
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement