Advertisement
vkv1986

ExcelColumn

Jan 9th, 2013
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.44 KB | None | 0 0
  1. using System;
  2.  
  3. class ExcelColumn
  4. {
  5.     static void Main()
  6.     {
  7.         int number = int.Parse(Console.ReadLine());
  8.         long code = 0;
  9.         for (int iteration = number; iteration > 0; iteration--)
  10.         {
  11.             string letter = Console.ReadLine();
  12.             long currentCode = letter[0] - 64;
  13.             code = code + (currentCode * (long)Math.Pow(26, iteration - 1));
  14.         }
  15.         Console.WriteLine(code);
  16.     }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement