FJNU-1159 Fat Brother’s new way
Description
I bet, except Fat Brothers, all of you don’t like strange way to show integers , he is really like this way to showing integers:
1 -> ‘A’
2 -> ‘B’
…….
26 -> ‘Z’
27 -> ‘AA’
28 -> ‘AB’
…….
Unfortunately, Fat Brother’s mathematics is poor, so he needs your help, he will give you some integers, and you must transform it with Fat Brother’s way.
Input
Input starts with an integer T(T <= 10000), denoting the number of test case.
For each test case, an integers n(1 <= n <= 2147483647) is given.
Output
For each case, output the corresponding string with upper-case letters.
Sample Input
3
17311
2068
37
Sample Output
YOU
CAN
AK
#include <iostream> using namespace std; int main(void) { char opt[20]; int t, a, i; cin >> t; while (t--) { cin >> a; for (i = -1; a--; a /= 26) { opt[++i] = 'A' + a % 26; } while (~i) { putchar(opt[i--]); } cout << endl; } return 0; }