广义回文素数:进制转换判断
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>
using namespace std;
typedef pair<int, int> PII;
typedef long long LL;
const int N = 1010;
int a[N];
int main( ){
bool flag = true;
int n,b;
cin >> n >> b;
int cnt = 0;
// 进制转换
do{
a[cnt++] = n % b;
n /= b;
} while(n);
for ( int i=0; i < cnt / 2; i++ ) {
if ( a[i] != a[cnt-i-1] ) {
flag = false;
break;
}
}
if ( !flag ) printf("No\n");
else printf("Yes\n");
for ( int i=cnt-1; i>=0; i-- ) {
if ( i > 0 ) printf("%d ", a[i]);
else printf("%d", a[i]);
}
return 0;
}