Advertisement
Guest User

Untitled

a guest
May 27th, 2016
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Numerics;
  7.  
  8. namespace podgotovka1vazada4a
  9. {
  10. class Program
  11. {
  12. static BigInteger MeowToDec(string meow)
  13. {
  14.  
  15. BigInteger sum = 0;
  16.  
  17. foreach (char digit in meow)
  18. {
  19. sum = (digit - 'a') + sum * 21;
  20. }
  21.  
  22. return sum;
  23.  
  24. }
  25. static string DecimalToMeow(BigInteger decValue)
  26. {
  27.  
  28. string result = string.Empty;
  29.  
  30. do
  31. {
  32. char digit = (char)('a' + (decValue % 26));
  33. result = digit + result;
  34. decValue /= 26;
  35.  
  36. } while (decValue > 0);
  37.  
  38. return result;
  39. }
  40.  
  41. static void Main(string[] args)
  42. {
  43. var input = Console.ReadLine().Split(' ').Select(MeowToDec).ToArray();
  44.  
  45.  
  46. foreach (var word in input)
  47. {
  48. var asnwer = DecimalToMeow(word);
  49. Console.Write(asnwer + " ");
  50. }
  51.  
  52. }
  53. }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement