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语句模拟解 ...
随机推荐
- JavaScript常用技巧之进制转换
一.十进制转二进制 (8).toString(2) 二.二进制转十进制 parseInt("1000",2) 三.获取当前时间戳 // 方法 Date.now() // 对象和操作 ...
- 十一、结构模式之享元(Flyweight)模式
什么是享元模式 享元模式是对象的结构模式,是运用共享技术来有效的支持大量细粒度的对象.享元对象能做到共享的关键是区分内蕴状态和外蕴状态.一个内蕴状态是存储在享元对象内部,并且是不会随环境改变而有所不同 ...
- Java线程的优先级设置遵循什么原则?
Java线程的优先级设置遵从下述原则: (1) 线程创建时,子线程继承父线程的优先级 (2) 线程创建后,可在程序中通过调用setPriority( )方法改变线程的优先级 (3) 线程的优先级是1~ ...
- H3C F100-S-G2接口配置
网络环境简单一台F100-S-G2(192.168.1.197),一台S3600,三台服务器(同一网段192.168.1~3),实现互通. 其他都不用说了配置成同一网段地址就行,主要说一下F100配置 ...
- Scrapy爬虫框架的使用
#_author:来童星#date:2019/12/24# Scrapy爬虫框架的使用#1.安装Twisted模块 https://www.lfd.uci.edu/~gohlke/pythonlibs ...
- Windows服务 --- SqlDependency的使用
1 启用当前数据库的 SQL Server Service Broker a 检查Service Broker 是否开启 SELECT is_broker_enabled FROM sys.d ...
- MariaDB 选择查询
在本章中,我们将学习如何从表中选择数据. SELECT语句检索所选行. 它们可以包括UNION语句,排序子句,LIMIT子句,WHERE子句,GROUP BY ... HAVING子句和子查询. 查看 ...
- ZOJ 1610 Count the Colors (线段树区间更新与统计)
Painting some colored segments on a line, some previously painted segments may be covered by some th ...
- OC学习篇之---循环引用问题
在之前的一片文章中,我们介绍了数组操作对象的时候引用问题以及自动释放池的概念: http://blog.csdn.net/jiangwei0910410003/article/details/4192 ...
- iOS 109个Demo范例
https://github.com/subdigital/nsscreencast 版权声明:本文为博主原创文章,未经博主允许不得转载.