Run ID 作者 问题 语言 测评结果 时间 内存 代码长度 提交时间
42115 老方 九进制回文数 C++ 编译错误 0 MS 0 KB 498 2024-02-24 10:35:54

Tests(0/0):


#include<bits/stdc++.h> using namespace std; bool z(int x,int jz=9){ while(x){ if(x%jz%2==0)return 0; x/=jz; } return 1; } int zhuan(int x,int jz=9){ int pos=1,a=0; while(x){ a=a+x%jz*pos; pos*=10; x/=jz; } return a; } bool hui(int n){ int h=0,num=n; while(n){ h=h*10+n%10; n/=10; }- if(num==h)return 1; return 0; } int main(){ int n,m,cnt; cin>>n>>m; for(int i=n;i<=m;i++){ if(z(i)&&hui(zhuan(i)))cnt++; } cout<<cnt; return 0; }


测评信息: