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 ...
随机推荐
- hadoop 基础
common 一组分布式文件系统和通用I/O的组件与接口(序列化.java RPC和持久化数据结构) Avro 一种支持高效.跨语言的RPC以及永久存储数据的序列化系统 MapReduce 分布式数据 ...
- Python思维导图(二)—— 数据类型
============================================== =========可点击图片, 放大查看更清晰哦!========= ===========有任何错误请及 ...
- django操作命令
下载安装 pip3 install django==1.11.21 -i https://pypi.tuna.tsinghua.edu.cn/simple 创建项目 1.终端找到存放项目的文件夹,dj ...
- Java入门 - 高级教程 - 07.多线程
原文地址:http://www.work100.net/training/java-multi-threading.html 更多教程:光束云 - 免费课程 多线程 序号 文内章节 视频 1 概述 2 ...
- python 父类方法重写
class Bird: def isWing(self): print("鸟有翅膀") def fly(self): print("鸟会飞") class Os ...
- .net core webapi搭建(3)Code first+拆层三层+仓储
将项目拆层 我们要 将项目拆分成 Infrastructure 基础层 Core 核心层 Utility 工具 我们想在就 ...
- AVR单片机教程——矩阵键盘
本文隶属于AVR单片机教程系列. 开发板上有4个按键,我们可以把每一个按键连接到一个单片机引脚上,来实现按键状态的检测.但是常见的键盘有104键,是每一个键分别连接到一个引脚上的吗?我没有考证过, ...
- ios--->上下拉刷新控件MJRefresh
上下拉刷新控件MJRefresh 一.类结构 MJRefreshComponent.h MJRefreshHeader.h MJRefreshFooter.h MJRefreshAutoFooter. ...
- Shell之信号捕获
前言 当我们在运行某一段代码的时候,希望有类似事物一样的操作,要么成功,要么失败:一般的shell脚本都是自上而下,从左之后运行,碰到异常信号就会出错,从而终止脚本的运行,这个时候脚本可能运行到某一处 ...
- Android教程2020 - RecyclerView显示多种item
Android教程2020 - 系列总览 本文链接 前面我们已经用RecyclerView显示一些数据.也知道如何获取滑动的距离. 前面我们的列表中显示的都是同类数据.如果要在一个列表中显示不同类别的 ...