#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<cstring>
#include<cmath>
#include<map>
#define ll long long
using namespace std;
int ans[50];
int main()
{
int n,base,i,j;
while(scanf("%d%d",&n,&base)!=EOF)
{
i = 0;
while(n)
{
ans[i++]=n%base;
n/=base;
}
int f = 1;
for(j = 0;j<i;j++)
{
if(ans[j]!=ans[i-j-1])
{
f = 0;
break;
}
}
if(f)printf("Yes\n");
else printf("No\n");
for(j = i-1;j>0;j--)printf("%d ",ans[j]);
printf("%d\n",ans[0]);
}
return 0;
}
pat1019 General Palindromic Number
最新推荐文章于 2021-02-18 10:58:51 发布