题目大意:

行和列的两种方式。
A是1, B是2,....Z是26, AA是27, AB是28...........
如: BC23代表55列23行
还有一种表示方法:R23C55, 代表23行,55列。
 
要求这两种数字之间相互转化。
=========================================================================
需要注意的就是两点:
1. 每个数字对26取余数后要再 - 1,再+‘A’ 就是答案了。
2. 如果余数是0则要对C--,并且输出的字符是Z、
 
 
 
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <cstring>
#include <cstdio>
#include <vector>
#include <cstdlib>
using namespace std;
typedef long long LL;
const LL INF = 0xffffff;
const int maxn = ;
const LL MOD = 1e9+;
void Putt(int C)
{
if(C == )
return ;
if(C% == )
Putt((C-)/);
else
Putt(C/);
char ch;
if(C% == )
ch = 'Z';
else
ch = C% + 'A' - ;
printf("%c", ch);
} void ChangeOne(char str[])
{
int R, C;
sscanf(str,"R%dC%d", &R, &C); Putt(C);
printf("%d\n", R);
} void ChangeTow(char str[])
{
int num = , i;
for(i=; str[i] >= 'A' && str[i] <= 'Z'; i++)
{
num = num* + str[i] - 'A' + ;
}
printf("R%sC%d\n",str+i, num);
}
bool Ok(char str[])
{
if(str[] == 'R' && str[] >= '' && str[] <= '')
{
for(int i=; str[i]; i++)
{
if(str[i] == 'C')
return true;
}
}
return false;
} int main()
{
int T;
char str[];
scanf("%d", &T);
while(T--)
{
cin >> str; if(Ok(str))
ChangeOne(str);
else
ChangeTow(str); }
return ;
}
/*
26 Z
27 AA
53 BA
BZ 78
CA 79
*/

1B. Spreadsheets的更多相关文章

  1. 【题解】codeforces 1B Spreadsheets

    题意翻译 人们常用的电子表格软件(比如: Excel)采用如下所述的坐标系统:第一列被标为A,第二列为B,以此类推,第26列为Z.接下来为由两个字母构成的列号: 第27列为AA,第28列为AB-在标为 ...

  2. codeforces 1B Spreadsheets

    In the popular spreadsheets systems (for example, in Excel) the following numeration of columns is u ...

  3. CodeForces 1B Spreadsheets (字符串处理,注意细节,大胆尝试)

    题目 注意模后余数为0时,要把除以26后的新数据减1,为什么这样,要靠大胆尝试.我在对小比赛中坑了一下午啊,直到比赛结束也没写出这道题....要死了.. #include<stdio.h> ...

  4. 【Codeforces 1B】Spreadsheets

    [链接] 我是链接,点我呀:) [题意] A~Z分别对应了1~26 AA是27依次类推 让你完成双向的转换 [题解] 转换方法说实话特别恶心>_< int转string 得像数位DP一样一 ...

  5. WeisEditor 3.2.1B 使用说明 [源码下载]

    WeisEditor 使用说明 1. 首先打开(Weiseditor)编辑器文件夹下js/config.js 如果此时你的项目是一个虚拟目录项目 WeisConfig.isVirtualPath = ...

  6. cf------(round)#1 B. Spreadsheets(模拟)

    B. Spreadsheets time limit per test 10 seconds memory limit per test 64 megabytes input standard inp ...

  7. CF Spreadsheets (数学)

    Spreadsheets time limit per test 10 seconds memory limit per test 64 megabytes input standard input ...

  8. Spreadsheets

    很水的一道题,提醒自己要认真,做的头都快晕了.考虑26的特殊情况. D - Spreadsheets Time Limit:10000MS     Memory Limit:65536KB     6 ...

  9. Missing artifact javax.transaction:jta:jar:1.0.1B

    下载https://pan.baidu.com/s/1hsfyj8S到某目录,比如: /Users/yintingting/Downloads 打开terminal,cd /Users/yinting ...

随机推荐

  1. 关于HTTP请求报文和响应报文学习笔记

    超文本传输协议(Hypertext Transfer Protocol,简称HTTP)是应用层的一种通信协议.它是一种请求/响应式的协议,即一个客户端与服务器建立连接后,向服务器发送一个请求;服务器接 ...

  2. java 基本类型和包装类的比较

    public class BoxingTest { @Test public void test1(){ String a = new String("1"); String b ...

  3. 最简单的基于FFmpeg的推流器(以推送RTMP为例)

    ===================================================== 最简单的基于FFmpeg的推流器系列文章列表: <最简单的基于FFmpeg的推流器(以 ...

  4. saiku

    1.saiku下载http://community.meteorite.bi/可以下载各个版本的源代码 2.下载到   saiku-latest.zip 3.解压运行比较简单     解压出来的目录: ...

  5. 13号中断 int 13(转)

    第一部分      简      介      1,1      一.    硬盘结构简介              1.    硬盘参数释疑              到目前为止,    人们常说的 ...

  6. magento站点还原到本地

    问题描述 首先将网站文件夹解压到xampp/htdocs/wenjianjia目录下,然后替换sql文件里的域名为localhost/wenjianjia.然后访问前台,正常.访问后台,出问题了 Ma ...

  7. jquery元素查找方法集锦

    jQuery常用的元素查找方法总结 $("#myELement")    选择id值等于myElement的元素,id值不能重复在文档中只能有一个id值是myElement所以得到 ...

  8. js打开新的窗体不被浏览器阻止

    转载自js弹出新窗口而不会被浏览器阻止的方法有时候希望可以用js另开新窗口,但用window.open方法打开窗口总是被浏览器阻止, 可以用下面的方法打开新窗口而不会遭到拦截 1.新添加一个Form ...

  9. Linux——搭建PHP开发环境第三步:mysql

    原文链接:http://www.jb51.net/article/83647.htm 1.第一步就是看linu是否安装了mysql,经过rpm -qa|grep mysql查看到centos下安装了m ...

  10. BZOJ 1019 汉诺塔

    Description 汉诺塔由三根柱子(分别用A B C表示)和n个大小互不相同的空心盘子组成.一开始n个盘子都摞在柱子A上,大的在下面,小的在上面,形成了一个塔状的锥形体. 对汉诺塔的一次合法的操 ...