CF 1B - Spreadsheets 点击打开链接
题意:对于行和列 有两种表现模式:一, R 23 C 55 即行编号和列编号。二,BC 23,字母加行编号 。其中字母类似于26进制
如BC 23 表示 列 55,行 23.
思路:只需将字母的数分开处理即可,字母和数字的转换可以类似于26进制之间的装换。不过,需注意的是,数字刚好整除26
需要特殊判断为‘Z’。
#include <iostream>
#include<cstring>
#include<cctype>
#include<cstdio>
using namespace std;
const int N=1e6+10;
char ch[N];
char c[1005];
int a[5];
void f1(int n)
{
if(n==0)
return ;
if(n%26==0)
f1(n/26-1);
else
f1(n/26);
char s;
if(n%26==0)
s='Z';
else
s=n%26-1+'A';
printf("%c",s);
}
void f2(char *ch)
{
int sum=0;
int len=strlen(ch);
for(int i=0;i<len;i++){
sum=sum*26+ch[i