Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- class KaspichanNumber
- {
- static void Main()
- {
- ulong input = ulong.Parse(Console.ReadLine());
- ulong numSystem = 256;
- List<ulong> listNumbers = ConvertToAny(input, numSystem);
- List<char> charNumbers = ConvertToChar(listNumbers);
- foreach (var ch in charNumbers)
- {
- Console.Write(ch);
- }
- }
- private static List<ulong> ConvertToAny(ulong number, ulong numSystem)
- {
- List<ulong> listNumbers = new List<ulong>();
- if (number == 0)
- {
- listNumbers.Add(0);
- }
- while (number > 0)
- {
- listNumbers.Add(number % numSystem);
- number = number / numSystem;
- }
- listNumbers.Reverse();
- return listNumbers;
- }
- private static List<char> ConvertToChar(List<ulong> listNumbers)
- {
- List<char> listChars = new List<char>();
- foreach (ulong numb in listNumbers)
- {
- List<ulong> listNumbers26 = new List<ulong>();
- ulong temp = numb;
- if (temp == 0)
- {
- listNumbers26.Add(0);
- }
- while (temp > 0)
- {
- listNumbers26.Add(temp % 26);
- temp = temp / 26;
- }
- //listNumbers26.Reverse();
- for (int i = listNumbers26.Count - 1; i >= 0; i--)
- {
- if (i == 1)
- {
- listChars.Add((char)(listNumbers26[i] + 96));
- }
- else
- {
- listChars.Add((char)(listNumbers26[i] + 65));
- }
- }
- }
- return listChars;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement