1019 General Palindromic Number (20 分) 【难度: 简单 / 知识点: 判断回文】
作者:互联网
https://pintia.cn/problem-sets/994805342720868352/problems/994805487143337984
#include<bits/stdc++.h>
using namespace std;
int n,b;
void f(int n,int b)
{
if(!n)
{
cout<<"Yes"<<endl<<0;
return;
}
vector<int>s,temp;
while(n) s.push_back(n%b),n/=b;
temp=s;
reverse(s.begin(),s.end());
if(temp==s) puts("Yes");
else puts("No");
for(int i=0;i<s.size();i++)
{
if(i) cout<<" ";
cout<<s[i];
}
}
int main(void)
{
cin>>n>>b;
f(n,b);
return 0;
}
标签:知识点,20,temp,puts,Palindromic,int,No,cn 来源: https://blog.csdn.net/qq_46527915/article/details/120256864