Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- namespace ConsoleApp2
- {
- class Program
- {
- static void Main(string[] args)
- {
- var K = 8;
- var arr = new int[] { 123, 249, 242, 234 };
- for (int i = 0; i < arr.Length; i++)
- {
- int numberInNewNumberSystem = 0;
- while (arr[i] > 0)
- {
- numberInNewNumberSystem += arr[i] % K;
- arr[i] = arr[i] / K;
- }
- arr[i] = numberInNewNumberSystem;
- }
- var hashSet = new HashSet<int>();
- int result = 0;
- for (int i = 0; i < arr.Length; i++)
- {
- if (!hashSet.Contains(arr[i]))
- {
- hashSet.Add(arr[i]);
- result++;
- }
- }
- Console.WriteLine(result);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement