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语句模拟解 ...
随机推荐
- Bootstrap 网页1
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title&g ...
- OpenLayers学习笔记(十二)— 飞机速度矢量线预测(二)
根据计算公式实现预测线 作者:狐狸家的鱼 GitHub:八至 之前有一篇博客简单写了一个模拟demo,根据物体当前的速度和方向预测多少时间后所在的位置,具体计算是参考<(译)计算距离.方位以及更 ...
- 当input中的内容改变时触发的事件
当input中的内容改变时触发的事件 1 $('#id').bind('input propertychange', function() { //处理内容 } 循环js事件 $(document). ...
- php number_format()函数 语法
php number_format()函数 语法 number_format()函数怎么用? php number_format()函数表示通过千位分组来格式化数字,语法是number_format( ...
- SCP-Py-002
项目编号:Py-002 项目等级:EuclidKeter 特殊收容措施: Py-002-1目前被映射在Researcher Kevin的服务器位于Site-Pyproject地下防无线电渗透室且被切断 ...
- Python基础(三):简化除法判断、分析apache访问日志、扫描存活主机、利用多线程实现ssh并发访问
一.简化除法判断 目标: 编写mydiv.py脚本,主要要求如下: 提示用户输入一个数字作为除数 如果用户按下Ctrl+C或Ctrl+D则退出程序 如果用户输入非数字字符,提示用户应该输入数字 如果用 ...
- 【HDOJ6581】Vacation(模拟)
题意:有标号从0到n的n+1辆车,每辆车离终点的距离为s[i],车长为l[i],速度为v[i],规定不能超车,问何时所有车都能过终点线 n<=1e5,保证 思路: #include<bit ...
- kvm无人值守安装centos6
nginx配置 server { listen default_server; server_name _; root /home/iso; # Load configuration files fo ...
- 膜神犇 DPH
神犇 DPH 让我写博客.但是,似乎我已经开始写了?!! I am young and naïve!!! Let us orz DPH! 上节课讲DFS,这个是我最擅长的.“暴力出奇迹”!
- scrapy原理
scarpy据说是目前最强大的爬虫框架,没有之一.就是这么自信. 官网都是这么说的. An open source and collaborative framework for extracting ...