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 Bai1
- {
- class Program
- {
- static void Main(string[] args)
- {
- int[] a = { 3, 4, 5, 1, 7, 10, 2};
- Array.Sort(a);
- List<int> res = new List<int>();
- int i = 1;
- int currentValue = a[0];
- res.Add(currentValue);
- while (i < a.Length )
- {
- while (currentValue == a[i]) i++;
- currentValue = a[i];
- res.Add(currentValue);
- i++;
- }
- Console.WriteLine(res.Count);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement