CodeForces 1B 模拟题。
Time Limit:10000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u
Description
Input
Output
输出n行,每行是对应的位置的转化结果。
Sample Input
Sample Output
#include<stdio.h>
#include<string.h>
#include<math.h>
#define max(a, b)(a > b ? a : b)
#define N 110000
char s[N], a[N];
int b[N];
void K(int n)
{
if(n>26)
K((n-1)/26);
printf("%c",(n-1)%26+'A');
}
int main()
{
int i, t, j, k, g, h, f, d, ans, n, m;
scanf("%d", &t);
while(t--)
{
memset(a, 0, sizeof(a));
memset(b, 0, sizeof(b));
scanf("%s", s);
k = j = g = f = d = 0;
for(int i=0; s[i]; i++)//数字字母分开存, 用j即数字的个数判断是那种转换类型。
{
if(s[i]>='0'&&s[i]<='9')
{
b[j] = b[j] * 10 + s[i] -'0';
f = 1;
}
else if(s[i]>='A'&&s[i]<='Z')
{
a[k++] = s[i];
if(f==1)
j++;
}
}
if(j == 0)//把用字母表示的列数转换成数字。
{
ans = 0;
for(i = 0; a[i]; i++)
{
ans = ans * 26 + a[i] - 'A' + 1;//类似于把字符类型的数字转换成数字, 26一个周期。
}
printf("R%dC%d\n", b[0], ans);
}
else//把用数字表示的列数转换成字母。
{
K(b[1]);
printf("%d\n",b[0]);
}
}
return 0;
}
CodeForces 1B 模拟题。的更多相关文章
- 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 - 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 1B 模拟
题目大意: 给出两种行列位置的表示方法,一个是Excel表示法,一个是(R,C)坐标表示.给出一种表示,输出另外一种表示. 基本思路: 模拟,首先判断是哪一种表示法,然后转换成另外一种表示方法: 我做 ...
- Educational Codeforces Round 2 A. Extract Numbers 模拟题
A. Extract Numbers Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/600/pr ...
- Codeforces 767B. The Queue 模拟题
B. The Queue time limit per test:1 second memory limit per test:256 megabytes input:standard input o ...
- Codeforces Beta Round #7 B. Memory Manager 模拟题
B. Memory Manager 题目连接: http://www.codeforces.com/contest/7/problem/B Description There is little ti ...
- Codeforces Beta Round #5 B. Center Alignment 模拟题
B. Center Alignment 题目连接: http://www.codeforces.com/contest/5/problem/B Description Almost every tex ...
随机推荐
- Java架构师中的内存溢出和内存泄露是什么?实际操作案例!
JAVA中的内存溢出和内存泄露分别是什么,有什么联系和区别,让我们来看一看. 01 内存泄漏 & 内存溢出 1.内存泄漏(memory leak ) 申请了内存用完了不释放,比如一共有 102 ...
- $.fn.serializeObject对为disabled属性的失效
问题现象: 在查生产tomcat下的localhost日志时,发现今天的记录有不少次都报org.apache.ibatis.exceptions.TooManyResultsException: Ex ...
- wtforms 钩子函数
参考: https://www.cnblogs.com/wupeiqi/articles/8202357.html class LoginForm(Form): name = simple.Strin ...
- Http协议 Content-Type
详情:https://www.cnblogs.com/ranyonsue/p/5984001.html *****Referer:包含一个URL,用户从该URL代表的页面出发访问当前请求的页面. ** ...
- spring boot部署中executable的系统服务
首先在pom.xml 中添加spring boot插件,并设置 <plugins> <plugin> <groupId>org.springframework.bo ...
- [洛谷P3254] [网络流24题] 圆桌游戏
Description 假设有来自m 个不同单位的代表参加一次国际会议.每个单位的代表数分别为ri (i =1,2,--,m). 会议餐厅共有n 张餐桌,每张餐桌可容纳ci (i =1,2,--,n) ...
- 第二阶段冲刺个人任务——one
今日任务: 修改注册界面.
- 重写ThreadFactory方法和拒绝策略
最近项目中要用到多线程处理任务,自然就用到了ThreadPoolTaskExecutor这个对象,这个是spring对于Java的concurrent包下的ThreadPoolExecutor类的封装 ...
- ERR : undefined reference to something
序言: define : 定义.相信你用过 #define PI 3.141592653 (千万记得别在这句代码后加分号) reference : 引用 undefined reference to ...
- ios---apple mach-o linker error 报错解决
问题触发场景 在新xcode环境里配置了cocoapods,并运行了自己的项目.然后某日从其他地方clone了第三方项目,打开后,有了这个报错: 问题原因 1.用cocoapods装了第三方插件后,要 ...