codeforces 1B 模拟
题目大意:
//我没有处理好的部分
int tot=0;
while(N){
if(N%26==0){
res[tot++]='Z';
N=N/26-1;
}else{
res[tot++]='A'-1+N%26;
N=N/26;
}
} //题解代码:
#include<cstdio>
#include<iostream>
#include<cstring>
#include<cmath>
#include<algorithm> using namespace std; typedef long long ll;
const int inf = 0x3f3f3f3f;
const int maxn = 100000+10; char str[maxn];
char res[maxn];
int main(){
int n;
while(scanf("%d",&n)==1){
while(n--){
scanf("%s",str);
int len=strlen(str);
for(int i=0;i<len;i++){
if(str[i]>='a'&&str[i]<='z') str[i]=str[i]-'a'+'A';
}
int i=0;
while(i<len&&isalpha(str[i])){
i++;
}
while(i<len&&isdigit(str[i])){
i++;
}
if(i>=len){
int C=0,N=0;
int id=0;
while(id<len&&isalpha(str[id])){
C=C*26+str[id]-'A'+1;
id++;
}
while(id<len&&isdigit(str[id])){
N=N*10+str[id]-'0';
id++;
}
printf("R%dC%d\n",N,C);
}else{
int C=0,N=0;
int id=1;
while(id<len&&isdigit(str[id])){
C=C*10+str[id]-'0';
id++;
}
id++;
while(id<len&&isdigit(str[id])){
N=N*10+str[id]-'0';
id++;
}
int tot=0;
while(N){
if(N%26==0){
res[tot++]='Z';
N=N/26-1;
}else{
res[tot++]='A'-1+N%26;
N=N/26;
}
}
for(int i=tot-1;i>=0;i--) printf("%c",res[i]);
printf("%d\n",C);
}
}
}
return 0;
}
codeforces 1B 模拟的更多相关文章
- CodeForces 1B 模拟题。
H - 8 Time Limit:10000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u Submit Statu ...
- CodeForces - 427B (模拟题)
Prison Transfer Time Limit: 1000MS Memory Limit: 262144KB 64bit IO Format: %I64d & %I64u Sub ...
- CodeForces - 404B(模拟题)
Marathon Time Limit: 1000MS Memory Limit: 262144KB 64bit IO Format: %I64d & %I64u Submit Sta ...
- Codeforces 709B 模拟
B. Checkpoints time limit per test:1 second memory limit per test:256 megabytes input:standard input ...
- CodeForces - 404A(模拟题)
Valera and X Time Limit: 1000MS Memory Limit: 262144KB 64bit IO Format: %I64d & %I64u Submit ...
- Codeforces 390A( 模拟题)
Inna and Alarm Clock Time Limit: 1000MS Memory Limit: 262144KB 64bit IO Format: %I64d & %I64 ...
- Codeforces 452D [模拟][贪心]
题意: 给你k件衣服处理,告诉你洗衣机烘干机折叠机的数量,和它们处理一件衣服的时间,要求一件衣服在洗完之后必须立刻烘干,烘干之后必须立刻折叠,问所需的最小时间. 思路: 1.按照时间模拟 2.若洗完的 ...
- CodeForces - 796B 模拟
思路:模拟移动即可,如果球落入洞中停止移动.注意:有可能第一个位置就是洞!! AC代码 #include <cstdio> #include <cmath> #include ...
- CodeForces - 864C-Bus-(模拟加油站问题)
https://vjudge.net/problem/CodeForces-864C 题意:两地之间有个加油站,往返走k个单程,最少加油多少次. 大佬几十行代码就解决,我却要用一百多行的if语句模拟解 ...
随机推荐
- 前端学习(二十七)存储&es6(笔记)
cookie 存储 以站点为单位的. 必须配合服务器环境 不能跨浏览器 cookie有生命周期 默认是session session ...
- linux CentOS7 nginx nginx-rtmp-module搭建直播
直播配置 1. 安装 Nginx 依赖软件 yum -y install gcc gcc-c++ autoconf automake make yum -y install zlib zlib-dev ...
- java基础学习笔记六(继承)
继承的概念 继承是java面向对象编程技术的一块基石,因为它允许创建分等级层次的类. 继承就是子类继承父类的特征和行为,使得子类对象(实例)具有父类的实例域和方法,或子类从父类继承方法,使得子类具有父 ...
- Vue学习笔记【31】——Vue路由(computed计算属性的使用)
computed计算属性的使用 默认只有getter的计算属性: <div id="app"> <input type="text" ...
- Linux CentOS-7.4-x86_64(原版) 百度网盘下载
因为CentOS-7-x86_64-DVD-1804.iso 镜像文件4.16G,超出了上传百度网盘的单个文件大小限制(4G), 所以这里先现将ISO镜像文件压缩成RAR包,然后上传网盘. 使用的话, ...
- API参考文档
Android 中文版:http://www.apiref.com/android-zh/index.html Bootstrap3 教程:http://www.apiref.com/bootstra ...
- linux中软连接和硬链接的区别
linux中创建软连接和硬链接的方法: 软连接: ln -s oldfile slink 硬连接: ln oldfile hlink linux中创建软连接和硬链接的区别: 原理上,硬链 ...
- HTML-参考手册: HTML 字符集
ylbtech-HTML-参考手册: HTML 字符集 1.返回顶部 1. HTML 字符集 HTML 字符集 如需正确地显示 HTML 页面,浏览器必须知道使用何种字符集. 万维网早期使用的字符集是 ...
- HTML-参考手册: 画布
ylbtech-HTML-参考手册: 画布 1.返回顶部 1. HTML5 <canvas> 参考手册 描述 HTML5 <canvas> 标签用于绘制图像(通过脚本,通常是 ...
- 93、R语言教程详解
加载数据 > w<-read.table("test.prn",header = T) > w X.. X...1 1 A 2 2 B 3 3 C 5 4 D 5 ...