提交时间:2024-02-24 10:37:16

运行 ID: 42122

#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 1; } 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; }