蓝桥杯——年号字串
出自蓝桥杯第十届C/C++大学B组 试题B
#include <bits/stdc++.h>
using namespace std;
char ch[28] = "ZABCDEFGHIJKLMNOPQRSTUVWXY";
int main()
{
string str;
int n ;
cin >> n;
while(n)
{
str += ch[n%26];
n/=26;
}
for(int i = str.size() - 1; i >= 0; i--)
cout << str[i];
return 0;
}
答案:BYQ