题目大意:

行和列的两种方式。
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. AS插件开发 RemoveButterKnife从构思到实现

    ReomveButterKnife插件 这是一个用于移除代码中对ButterKnife使用的AS插件,接下来我们将从头开始讲讲这个插件的开发过程 地址是 https://github.com/u3sh ...

  2. datagrid后台给每列添加js方法

    protected void dgExhList_ItemDataBound(object sender, DataGridItemEventArgs e) { string param = &quo ...

  3. 段落排版--缩进(text-indent)

    中文文字中的段前习惯空两个文字的空白,这个特殊的样式可以用下面代码来实现: p{text-indent:2em;} <p>1922年的春天,一个想要成名名叫尼克卡拉威(托比?马奎尔Tobe ...

  4. 文字排版--字体(font-family)

    我们可以使用css样式为网页中的文字设置字体.字号.颜色等样式属性.下面我们来看一个例子,下面代码实现:为网页中的文字设置字体为宋体. body{font-family:"宋体"; ...

  5. WPF 自定义滚动条样式

    先看一下效果: 先分析一下滚动条有哪儿几部分组成: 滚动条总共有五部分组成: 两端的箭头按钮,实际类型为RepeatButton Thumb 两端的空白,实际也是RepeatButton 最后就是Th ...

  6. 安卓开发之viewpager学习(头条显示)

    activity_luancher.xml代码如下: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res ...

  7. hash表的建立和查找

    (1)冲突处理方法为:顺次循环后移到下一个位置,寻找空位插入.(2)BKDE 字符串哈希unsigned int hash_BKDE(char *str){/* 初始种子seed 可取31 131 1 ...

  8. 将日期和时间作为 struct tm型的值直接向二进制文件进行读写

    #include <stdio.h> #include <time.h> char data_file[]="D:\\%\\datetime.dat"; v ...

  9. 『重构--改善既有代码的设计』读书笔记----Introduce Local Extension

    同Introduce Foreign Method一样,很多时候你不能修改编辑原始类,你需要为这些服务类增加一些额外的函数,但你没有这个权限或者入口.如果你只需要一个或者两个外加函数那么你可以放心的使 ...

  10. 微信开发python+django两个月的成功经历,django是个好框架!

        时间:大三 上学期没有用微信内置浏览器而纯对话开发,坑了自己好一下. 下学期选错bottle框架,以为轻量好,谁知开发中什么都自己来很痛苦. 选对了框架django,终于在大三最后的个把月里写 ...