首页 > 其他 > 详细

FJNU-1159 Fat Brother’s new way

时间:2017-03-26 20:05:23      阅读:244      评论:0      收藏:0      [点我收藏+]

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

原文:http://www.cnblogs.com/limyel/p/6623467.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!