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 SortedDictionary
- {
- class SortedNumbers
- {
- static void Main()
- {
- var nums = Console.ReadLine().Split(' ').Select(double.Parse).ToList();
- var count = new SortedDictionary<double, int>();
- foreach(var n in nums)
- {
- if (count.ContainsKey(n))
- {
- count[n]++;
- }
- else
- {
- count[n] = 1;
- }
- }
- foreach(var pair in count)
- {
- Console.WriteLine("{0} - {1} times", pair.Key, pair.Value);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment