首页 > 代码库 > FJNU-1159 Fat Brother’s new way
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; }
FJNU-1159 Fat Brother’s new way
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。