描述:
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.
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.
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.
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 .
输出:
Write n lines, each line should contain a cell coordinates in the other numeration system.
样例输入:
2 R23C55 BC23
样例输出:
BC23 R23C55
描述:
在流行的电子表格系统(例如,在Excel中)中,使用以下列的计数,第一列是编号A,第二列是编号B,等等,直到第26列是编号Z。然后有2个字母的编号:第27列是编号AA,第28列编号AB,第52列是编号AZ。在编号ZZ之后接着有3个字母的编号,等等。
行数是用整数从1开始标记,单元格名字是列数和行数编号的拼接。例如,单元格的名字BC23是指在第55列,第23行。
有时也使用另一种计数系统:RXCY(X,Y都是正整数)。恭敬地显示出列数和行数的编号。例如,之前举例的单元格可以表示为R23C55。
你的任务是编写一个程序用来读取给定顺序的单元格坐标并根据另一种计数系统的规则产生每一项。
输入:
第一行输入包括一个整数n(1 ≤ n ≤ 105),坐标数在测试中。然后接下来有n行,每一行都包括坐标。所有的坐标都是正确的,单元格的列数和行数的编号均小于106。
输出:
输出n行,每一行应包括一个用其他计数系统所表示的单元格坐标。
样例输入:
2 R23C55 BC23
样例输出:
BC23 R23C55
题目地址链接:Problem - B - Codeforces