Run ID 作者 问题 语言 测评结果 时间 内存 代码长度 提交时间
42125 liusiyu 九进制回文数 C++ 编译错误 0 MS 0 KB 541 2024-02-24 10:40:37

Tests(0/0):


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


测评信息: