返回题解分享
讨论 / 题解分享/ 帖子详情

年号字串(结果填空) - 题解

#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;

typedef long long LL;

int main()
{
    string str = "ABCDEFGHIGKLMNOPQRSTUVWXYZ";
    int n;
    string res;
    cin >> n;
    while(n)
    {
        res.push_back(str[n%26 - 1]);
        n/=26;
    }
    reverse(res.begin(), res.end());
    cout << res;
    return 0;
}
0 回复 0 转发 0 喜欢 0 阅读
回复 (0)
默认 最新
暂无回复,快来抢沙发!