#include<iostream>
using namespace std;
int main(){
int n,b;
cin>>n>>b;
int num[1000];
int count=0;
while(n>0){
num[count]=n%b;
n=n/b;
count++;
}
int flag=1;
for(int i=0;i<count/2;i++){
if(num[i]!=num[count-i-1]){
flag=0;
break;
}
}
if(flag==1){
cout<<"Yes"<<endl;
}else{
cout<<"No"<<endl;
}
for(int i=count-1;i>=0;i--){
if(i==count-1){
cout<<num[i];
}else{
cout<<" "<<num[i];
}
}
return 0;
}
1019 General Palindromic Number (20分)
最新推荐文章于 2022-02-22 21:25:09 发布