码迷,mamicode.com
首页 > 其他好文 > 详细

FJNU-1159 Fat Brother’s new way

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

标签:des   new   div   std   tran   strong   log   range   ++   

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

标签:des   new   div   std   tran   strong   log   range   ++   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!