标签:std max return char* turn const bcd utc cst
水题。。。。。
#include <cstdio>
#include <cstring>
#define MAX 1005
const char* alpha = "ABCDEF";
int main(){
int n,r;
while(~scanf("%d%d",&n,&r)){
int k = 0;
if(n==0) { printf("0\n"); continue; }
if(n < 0) { n = -n; putchar(‘-‘);}
int res[MAX] = {0};
while(n){ res[k++] = n % r; n /= r; }
for(int i = k - 1;i >= 0;i --)
res[i]<10?printf("%d",res[i]):printf("%c",alpha[res[i]-10]);
printf("\n");
}
return 0;
}
标签:std max return char* turn const bcd utc cst
原文地址:https://www.cnblogs.com/1Kasshole/p/9694783.html