给定一个十进制数,判断这个数的radix进制数是不是回文数
#include<bits/stdc++.h>
using namespace std;
vector<int> convertNum;
void convert(long long num, int radix) {
do {
convertNum.push_back(num % radix);
num /= radix;
} while(num != 0);
}
int main() {
long long num;
int radix;
cin >> num >> radix;
convert(num, radix);
int flag = true;
for(int i = 0;i < convertNum.size()>>1;++i) {
if(convertNum[i] != convertNum[convertNum.size() - 1 - i]) {
flag = false;
break;
}
}
flag ? cout<<"Yes\n" : cout<<"No\n";
for(int i = convertNum.size() - 1;i >= 0 ;--i)
cout << convertNum[i] << (i == 0 ? "\n" : " ");
return 0;
}