Advertisement
stoianpp

Multiverse

Jan 17th, 2014
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.72 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.  
  7. class MultiverseCommunication
  8. {
  9.     static void Main()
  10.     {
  11.         string thirtNumSys = Console.ReadLine();
  12.         thirtNumSys = thirtNumSys.Replace(" ", string.Empty);
  13.         thirtNumSys = thirtNumSys.ToUpper();
  14.         string helpVar = string.Empty;
  15.         long sum = 0;
  16.  
  17.         for (int i = 0, j = thirtNumSys.Length / 3 - 1; i < thirtNumSys.Length; i = i + 3, j--)
  18.         {
  19.             helpVar = thirtNumSys.Substring(i, 3);
  20.             switch (helpVar)
  21.             {
  22.                 case "CHU": sum += 0; ; break;
  23.                 case "TEL": sum += 1 * PowerOgThirteen(j); break;
  24.                 case "OFT": sum += 2 * PowerOgThirteen(j); break;
  25.                 case "IVA": sum += 3 * PowerOgThirteen(j); break;
  26.                 case "EMY": sum += 4 * PowerOgThirteen(j); break;
  27.                 case "VNB": sum += 5 * PowerOgThirteen(j); break;
  28.                 case "POQ": sum += 6 * PowerOgThirteen(j); break;
  29.                 case "ERI": sum += 7 * PowerOgThirteen(j); break;
  30.                 case "CAD": sum += 8 * PowerOgThirteen(j); break;
  31.                 case "K-A": sum += 9 * PowerOgThirteen(j); break;
  32.                 case "IIA": sum += 10 * PowerOgThirteen(j); break;
  33.                 case "YLO": sum += 11 * PowerOgThirteen(j); break;
  34.                 case "PLA": sum += 12 * PowerOgThirteen(j); break;
  35.                 default: ; break;
  36.             }
  37.         }
  38.         Console.Write(sum);
  39.     }
  40.     static long PowerOgThirteen(int power)
  41.     {
  42.         long res = 1;
  43.         for (int i = 0; i < power; i++)
  44.         {
  45.             res *= 13;
  46.         }
  47.         return res;
  48.     }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement