题目:Spreadsheet | JXNUOJ
翻译:
Spreadsheet
10000ms 65536K
描述:
In the popular spreadsheets systems (for example, in Excel) the following numeration of columns is used. The first column has number A, the second — number B, etc. till column 26 that is marked by Z. Then there are two-letter numbers: column 27 has number AA, 28 — AB, column 52 is marked by AZ. After ZZ there follow three-letter numbers, etc.
在流行的电子表格系统(比如Excel)。第一列有数字A,第二列有数字B,一直到数字Z一共有26列。接着由两个英文数字组成:第27列有数字AA,第28列有数字AB,一直到数字AZ有52列。然后由三个英文字母组成,以此类推。
The rows are marked by integer numbers starting with 1. The cell name is the concatenation of the column and the row numbers. For example, BC23 is the name for the cell that is in column 55, row 23.
行被从1开始的整数标记。单元名字是行和列的合并,比如,BC23是第55列,第23行
Sometimes another numeration system is used: RXCY, where X and Y are integer numbers, showing the column and the row numbers respectfully. For instance, R23C55 is the cell from the previous example.
有时候也会使用到别的电子表格系统:RXCY。在这个系统中,X和Y是整数,代表了列和行。比如:R23C55是第23行第55列
Your task is to write a program that reads the given sequence of cell coordinates and produce each item written according to the rules of another numeration system.
你的任务是写一个程序,它能够读取给定的单元格序列然后根据另一个电子表格系统的规则输出对应的单元格序列。
输入:
The first line of the input contains integer number n (1 ≤ n ≤ 105), the number of coordinates in the test. Then there follow n lines, each of them contains coordinates. All the coordinates are correct, there are no cells with the column and/or the row numbers larger than 106 .
第一行的输入包含一个整数n(1 ≤ n ≤ 105),代表需要转换的单元格序列的数量。对于接下来的n行,每一行包含一个单元格序列。所有的单元格序列都是正确的,单元格的行和列不超过106.
输出:
Write n lines, each line should contain a cell coordinates in the other numeration system.
输出n行,每一行应该包含一个用另一种电子单元格系统表示的单元格序列
样例输入:
2
R23C55
BC23
样例输出:
BC23
R23C55