Letters Gym

来源:互联网 发布:以太网是什么网络 编辑:程序博客网 时间:2024/05/20 09:08

https://vjudge.net/contest/170300#problem/F

这道题目的思维量不大,但是看到别人的代码那么简介,还是要好好学。。

int main(){    //freopen("F.in","r",stdin);    LL now=26,len=1;    LL n;sf("%lld",&n);++n;    while(n>now*len){        n-=now*len,len++;now*=26;    }    char pre[30];    for(int i=1;i<=len;++i){        now/=26;        for(char p='A';p<='Z';++p){            if(n<=now*len){                pre[i]=p;break;            }            n-=now*len;        }    }    pf("%c\n",pre[n]);}