#include <bits/stdc++.h>
using namespace std;
bool huiwen(string s){
string c;
char x;
for(int i=0;i<=s.size()-1;i++){
x=s[i];
c=x+c;
}
if(c==s){
return true;
}else{
return false;
}
}
int main() {
int n,m,c=0,k;
char x;
string s;
cin>>n>>m;
for(int i=1; i<=n; i++) {
k=ii;
s="";
while(k!=0) {
if(k%m>=10) {
x=k%m-10+‘A’;
s=x+s;
} else {
x=k%m+‘0’;
s=x+s;
}
k=k/m;
}
if(huiwen(s)){
c++;
}
}
cout<<c;
}*
小X转进制
最新推荐文章于 2025-04-11 12:18:50 发布
此博客展示了一段C++代码,实现了回文数的判断功能。代码中定义了判断字符串是否为回文的函数,在主函数里通过循环生成不同进制的数并转换为字符串,调用判断函数统计回文数的数量,最后输出结果。
3092

被折叠的 条评论
为什么被折叠?



