https://www.nowcoder.com/pat/2/problem/268
吐槽:太简单!

#include<cstdio>
#include<cstring>
char str[50];
void change(int sum,int x){
    memset(str,0,sizeof(str));
    int  k = 0;
   do{
     int tmp = sum % x;
     if(tmp > 9) str[k++] = tmp + 'A' - 10;
     else str[k++] = tmp + '0';
     sum /= x;
   }while(sum!=0);
   for(int i=k-1;i>=0;i--){
    printf("%c",str[i]);
   }
   printf("\n");
}
int main(){
    int n,r;
    while(scanf("%d%d",&n,&r) != EOF){
        change(n,r); 
    } 
    return 0;
}