试题 B: 年号字串
本题总分:5 分
【问题描述】 小明用字母 A 对应数字 1,B 对应 2,以此类推,用 Z 对应 26。对于 27 以上的数字,小明用两位或更长位的字符串来对应,例如 AA 对应 27,AB 对 应 28,AZ 对应 52,LQ 对应 329。 请问 2019 对应的字符串是什么?
#include <stdio.h>
#include <stdlib.h>
//26进制
int main()
{
int a=0,b=0,c=0;//感觉是三位数
int y=2019;
while(y--){
a++;
if(a==27){
a=1;
b++;
if(b==27){
b=1;
c++;
}
}
}
printf("%c %c %c",c+'A'-1,b+'A'-1,a+'A'-1);
return 0;
//答案B Y Q
}
当然,考场配备有excel