Run ID 作者 问题 语言 测评结果 时间 内存 代码长度 提交时间
42060 Jeremy 九进制回文数 C++ 通过 0 MS 244 KB 393 2024-02-24 09:55:16

Tests(1/1):


#include<iostream> using namespace std; int main() { int jz=9,cnt=0; int n,m; cin>>n>>m; for(int i=n;i<m;i++){ int x=i; int a9=0,b9=0,pos=1; bool flag=true; while(x){ if(x%jz%2==0){ flag=false; break; } a9=a9*10+x%jz;//1 b9=b9+x%jz*pos;//1 pos=pos*10; x/=jz; } if(a9==b9&&flag){ cnt++; } } cout<<cnt; return 0; }


测评信息: