Run ID 作者 问题 语言 测评结果 时间 内存 代码长度 提交时间
42120 老方 九进制回文数 C++ 通过 0 MS 248 KB 499 2024-02-24 10:37:00

Tests(1/1):


#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=0; cin>>n>>m; for(int i=n;i<=m;i++){ if(z(i)&&hui(zhuan(i)))cnt++; } cout<<cnt; return 0; }


测评信息: