简单的进制转换与回文数的判定。
#include<stdio.h>
int main()
{
//freopen("in.txt","r",stdin);
int n, b;
scanf("%d %d",&n,&b);
int s[100];
int k=0;
do{
s[k++] = n % b;
n /= b;
}while(n!=0);
//s[k++] = n % b;
int i, flag = 1;
for(i=0; i<k/2; i++) {
if(s[i] != s[k-i-1]) {
flag = 0;
break;
}
}
if(flag)
printf("Yes\n");
else
printf("No\n");
for(i=k-1; i>0; i--) {
printf("%d ",s[i]);
}
printf("%d\n",s[i]);
return 0;
}