ellapt

FancyNumber

Dec 28th, 2012
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. using System;
  2. class FancyNumber
  3. {
  4. static void Main()
  5. {
  6. string inputN = Console.ReadLine();
  7. int digCnt = inputN.Length;
  8. string[,] n = { {"", "0","00","000","01","1","10","100","1000","02"},
  9. {"", "2","22","222","23","3","32","322","3222","24"},
  10. {"", "4","44","444","45","5","54","544","5444","46"},
  11. {"", "6","66","666","67","7","76","766","7666","68"} };
  12. int digit=0;
  13. string fancyNum = "";
  14. for (int offset = digCnt; offset > 0; offset--)
  15. {
  16. digit=int.Parse(inputN.Substring(offset-1,1));
  17. for (int i = 1; i < 10;i++)
  18. {
  19. if (digit == i)
  20. {
  21. fancyNum = n[digCnt-offset, i]+fancyNum;
  22. break;
  23. }
  24. }
  25. }
  26. Console.WriteLine(fancyNum);
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment