进制转换
#include<cstdio>
using namespace std;
char b[100];
int i,k,x,a[10000];
int main (){
for (i=0;i<=9;i++)b[i]=(char)(i+'0');
for (i=10;i<=36;i++)b[i]=(char)(i+55);
while (scanf("%d%d",&k,&x)==2){
bool fu=false;
if (k==0){printf("0\n");continue;}
if (k<0){fu=true;k=-k;}
int top=0;
while(k){
top++;
a[top]=k%x;
k=k/x;
}
if (fu)printf("-");
for (i=top;i>=1;i--)printf("%c",b[a[i]]);
printf("\n");
}
return 0;
}