CF1B.Spreadsheets

普及-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

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.

人们常用的电子表格软件(比如: Excel)采用如下所述的坐标系统:

第一列被标为 A,第二列为 B,以此类推,第 2626 列为 Z。接下来为由两个字母构成的列号: 第 2727 列为 AA,第 2828 列为 AB \cdots 在标为 ZZ 的列之后则由三个字母构成列号,如此类推。

行号为从 11 开始的整数。

单元格的坐标由列号和行号连接而成。比如,BC23 表示位于第 55552323 行的单元格。

有时也会采用被称为 RXCY 的坐标系统,其中 XXYY 为整数,坐标 (X(X,Y)Y) 直接描述了对应单元格的位置。比如,R23C55 即为前面所述的单元格。

您的任务是编写一个程序,将所给的单元格坐标转换为另一种坐标系统下面的形式。

输入格式

The first line of the input contains integer number nn ( 1<=n<=1051<=n<=10^{5} ), the number of coordinates in the test. Then there follow nn 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 10610^{6} .

第一行一个整数 nn (1(1 \le nn \le 105)10^5) 表示将会输入的坐标的数量。

接下来 nn 行,每行一个坐标。

注意: 每个坐标都是正确的。此外不会出现行号或列号大于 10610^6 的单元格。

输出 nn 行,每行一个被转换的坐标。

输出格式

Write nn lines, each line should contain a cell coordinates in the other numeration system.

nn 行,每行一个被转换的坐标。

输入输出样例

  • 输入#1

    2
    R23C55
    BC23

    输出#1

    BC23
    R23C55
首页