| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
把m转化为类26进制就行了Problem: 2273 User: langx
Memory: 164K Time: 0MS
Language: C++ Result: Accepted
-----------------------------------------
#include <iostream>
using namespace std;
char bit26[10];
int n, m;
int main(){
char ch;
int i;
while ( ~scanf("%c%d%c%d", &ch, &n, &ch, &m) && (n + m)) {
i = 0;
while ( m > 0) {
--m; //注意这个
bit26[i] = m % 26 + 'A';
m /= 26;
++i;
}
--i;
while ( i >= 0 ) {
printf("%c",bit26[i]);
--i;
}
printf("%d\n",n);
ch = getchar(); //去掉换行符
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator