CF1B.Spreadsheets

普及/提高-

通过率:0%

时间限制:10.00s

内存限制:64MB

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),列采用如下编号方式:第 1 列编号为 A,第 2 列编号为 B,……,第 26 列编号为 Z。接着是两位字母编号:第 27 列编号为 AA,第 28 列编号为 AB,第 52 列编号为 AZ。在 ZZ 之后是三位字母编号,依此类推。

行则用从 1 开始的整数编号。单元格名称由列编号与行编号拼接而成。例如,BC23 表示第 55 列、第 23 行的单元格。

有时会采用另一种编号系统:RXCY,其中 X 和 Y 是整数,分别表示行号和列号。例如,R23C55 即为上例中的单元格。

你的任务是编写一个程序,读入给定的一系列单元格坐标,并将每个坐标按另一种编号系统的规则输出。

输入格式

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 .

输入的第一行包含一个整数 nn(1 ≤ n ≤ 1051 ≤ n ≤ 10^5),表示测试中坐标的个数。接下来有 nn 行,每行包含一个坐标。所有坐标均合法,不存在列号和/或行号大于 10610^6 的格子。

输出格式

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

输出 n 行,每行应包含另一种编号系统下的单元格坐标。

输入输出样例

  • 输入#1

    2
    R23C55
    BC23

    输出#1

    BC23
    R23C55

输入解题思路,AI测评打分。不知道怎么写?

首页