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 ...
随机推荐
- DP-Fibonacci
善于发现 DP 中的 Fibonacci 我们在做 DP 题时 , 会发现有一些题 类似于找规律的题 ,观察测试样例 , 要对数据敏感 , 比如输入 2 输出 1 , 输入 3 就输出 2 …… ...
- 村庄之间建立邮局 - 区间 dp
There is a straight highway with villages alongside the highway. The highway is represented as an in ...
- crawler 听课笔记 碎碎念 3 关于python的细枝末节的回顾复习
和廖雪峰大神的教程学了几遍后,还是出现了许多不足,于是就做一些回顾,列出一些python的细节问题,有一些就提一下,如果发现不清楚的话 还请移步https://www.liaoxuefeng.com/ ...
- [bzoj4571] [loj#2016] [Scoi2016] 美味
Description 一家餐厅有 \(n\) 道菜,编号 \(1\)...\(n\) ,大家对第 \(i\) 道菜的评价值为 \(ai\)( \(1 \leq i \leq n\) ).有 \(m\ ...
- 「 从0到1学习微服务SpringCloud 」07 RabbitMq的基本使用
系列文章(更新ing): 「 从0到1学习微服务SpringCloud 」01 一起来学呀! 「 从0到1学习微服务SpringCloud 」02 Eureka服务注册与发现 「 从0到1学习微服务S ...
- 剑指Offer对答如流系列 - 实现Singleton模式
目录 面试题2:实现Singleton模式 一.懒汉式写法 二.饿汉式写法 三.枚举 面试题2:实现Singleton模式 题目:设计一个类,我们只能生成该类的一个实例. 由于设计模式在面向对象程序设 ...
- hge引擎使用技巧
图片周围最好留出一像素,即上下左右都多出一像素.然后使用pngopt.exe处理一下.这样可以减少图片拉伸.旋转时边界模糊的情况 图片宽高最好是 2的N次方
- OpenCV2.4.13+VS2013配置方法
先说一下vc几代表的对应版本: vc8 = Visual Studio 2005 vc9 = Visual Studio 2008 vc10 = Visual Studio 2010 vc11 = V ...
- 《高性能MySQL》之MySQL查询性能优化
为什么查询会慢? 响应时间过长.如果把查询看做是一个任务,那么它由一系列子任务组成,每个子任务都会消耗一定的时间.如果要优化查询,实际上优化其子任务,要么消除其中一些子任务,要么减少子任务的执行次数, ...
- 【阿K学Python系列】一Python基础语法(二)
前言 通过上一章的学习[阿k学Python]一Python入门(一),我们已经初步了解到Python是一种解释型.面向对象.动态数据类型的高级程序设计语言,当然也是一门脚本语言,像前端需要学习的Jav ...