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语句模拟解 ...
随机推荐
- 转载:Angular的filter总结
过滤器(filter)正如其名,作用就是接收一个输入,通过某个规则进行处理,然后返回处理后的结果.主要用在数据的格式化上,例如获取一个数组 中的子集,对数组中的元素进行排序等.ng内置了一些过滤器,它 ...
- SSM框架搭建过程
引入依赖的jar包(pom.xml) a. <!--Spring SpringMVC相关--> spring-webmvc b. <!--Spring事务--> sprin ...
- Kaggle数据集下载
Kaggle数据集下载步骤: 安装Kaggle库: 注册Kaggle账户: 找到数据集,接受rules: 在My Account>>API中,点击Create New API Token, ...
- 【leetcode】987. Vertical Order Traversal of a Binary Tree
题目如下: Given a binary tree, return the vertical order traversal of its nodes values. For each node at ...
- STM32的结构和启动模式
一.STM32F10x功能模块 32位的Cortex-M3微处理器: 可嵌套的向量中断控制器(NVIC)和60个可屏蔽中断且有16个可编程优先级: 内嵌内存: FLASH:最大512K字节 STAM: ...
- CodeForces 731D (差分+线段扫描)
Description Archeologists have found a secret pass in the dungeon of one of the pyramids of Cyclelan ...
- eureka学习(二)
eureka服务端创建好后,现在我们让eureka客户端(也就是服务提供者)注册到eureka上去. 首先加入依赖包: <!--将微服务provider注册到eureka--> <d ...
- L1、L2损失函数、Huber损失函数
L1范数损失函数,也被称为最小绝对值偏差(LAD),最小绝对值误差(LAE) L2范数损失函数,也被称为最小平方误差(LSE) L2损失函数 L1损失函数 不是非常的鲁棒(robust) 鲁棒 稳定解 ...
- CSS 提示工具(Tooltip)
CSS 提示工具(Tooltip) 本文为大家介绍如何使用HTML和CSS来实现提示工具, 提示工具在鼠标移动到制定元素后触发,先看下面示例: 1.基础提示工具代码如下: <!doctye ht ...
- 整合SSH
Hibernate知识: 1.核心配置文件: 连接数据库信息.连接池配置 映射配置 Struts2: 1.相关操作: 创建方式: 写一个类,写上public String execute():方法 实 ...