题目链接:https://acs.jxnu.edu.cn/problem/CF1B
题目:Spreadsheet
描述:
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.
我的见解:
有一种特殊的表示数字的方法,第一列用 A 表示,第二列用 B 表示等等,直到第26列用 Z 表示.如果超出26,则用两个字母表示,如 AA 表示为27,BB 表示为28,52 表示为 AZ。如果在超出52,则用三个字母表示(其余的与次规律相同)。而行则用数字表示(从一开始)。如BC28则表示第55列第28行。还有一种表示方法用RXCY来表示,X,Y都为正整数,R代表行,C代表列。如R23C55表示第55列第28行。你的任务就是将两种表示方法互相转换。
输入: 第一行输入为n(1<=n<=10的5次方)表示接下来要输入n行数字以及字母且都是正确的(行和列都不会超过10的6次方)。
输出:输出n行表示相互转换的结果。
电脑翻译:
描述:
在流行的电子表格系统(例如,在 Excel 中)中,使用以下列数。第一个列有数字A,第二个 - 数字B等,直到由Z标记的第26列。然后是两个字母的数字:列 27 有数字 AA,28 — AB,列 52 用 AZ 标记。在ZZ之后,有三个字母的数字,依此类推。
这些行由以 1 开头的整数标记。单元格名称是列和行号的串联。例如,BC23 是第 55 列第 23 行中的单元格的名称。
有时使用另一种计算系统:RXCY,其中X和Y是整数,尊重地显示列和行号。例如,R23C55 是上一个示例中的单元格。
您的任务是编写一个程序,该程序读取给定的单元格坐标序列,并根据另一个计数系统的规则生成每个项目。
输入:
输入的第一行包含整数n (1 ≤ n ≤ 10的5次方),测试中的坐标数。然后有n行,每行都包含坐标。所有坐标都是正确的,没有列和/或行号大于10的6次方.
输出:
写n行,每行应包含其他计数系统中的单元格坐标。