AtCoder Beginner Contest 171 比赛人数10532 比赛开始后14分钟看到A题,之后,每过一分钟看到一道题
AtCoder Beginner Contest 171 C One Quadrillion and One Dalmatians 26进制
总目录详见https://blog.csdn.net/mrcrack/article/details/104454762
在线测评地址https://atcoder.jp/contests/abc171/tasks/abc171_c
题目大意:用数字标记字符串,字母a-z轮番出动,给定具体数值,输出其标记的字符串
基本思路:识别出是26进制,具体编码过程中,费了些劲,具体详见代码。比赛中,是先解决了D题,才来解决C题,记得当时给C题整蒙了。
AC代码如下:
#include <stdio.h>
#define LL long long
int st[20],top;
int main(){
LL n;
int i;
scanf("%lld",&n);
while(n){
st[++top]=(n-1)%26;//(n-1)考验智慧,在不断的模拟中才发现的
n--;//n--考验智慧,在不断的模拟中才发现的
n/=26;
}
for(i=top;i>=1;i--)printf("%c",'a'+st[i]);
printf("\n");
return 0;
}