#include <cstdio>
const int NAXN = 1010;
int N, R, number[NAXN], len = 0;
bool check() {
for(int i=0; i<len/2; i++) {
if(number[i] != number[len - 1 - i]) return false;
}
return true;
}
int main() {
scanf("%d%d",&N,&R);
do{
number[len++] = N % R;
N /= R;
} while(N != 0);
if(check()) printf("Yes\n");
else printf("No\n");
for(int i=len - 1; i>=0; i--) {
printf("%d",number[i]);
if(i != 0) printf(" ");
}
return 0;
}
1019 General Palindromic Number (20)
最新推荐文章于 2022-07-17 21:31:43 发布