Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class ExcelColumns
- {
- static void Main()
- {
- // input
- int n = int.Parse(Console.ReadLine());
- char identifier = new char();
- long result = 0;
- for (int i = n; i > 0; i--)
- {
- identifier = char.Parse(Console.ReadLine());
- if (i == 1)
- {
- result += (long)(identifier - 'A' + 1);
- }
- else
- {
- result += (long)(identifier - 'A' + 1) * (long)Math.Pow(26, i - 1);
- }
- }
- Console.WriteLine(result);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement