#include <iostream>
using namespace std;
unsigned long long l;
unsigned long long r;
unsigned long long c;
bool check;
int main(){
ios_base::sync_with_stdio(0);
c=0;
cin>>l>>r;
for(int i=l; i<=r; i++){
check = true;
unsigned long long b=1;
for(int j=2; j<19; j++){
b *= 10;
if(i%b == 0){
check = false;
break;
}
if((int)((i%b)*10/b) == 0 || i%(int)((i%b)*10/b) != 0){
check = false;
break;
}
if(i < b){
break;
}
}
if(check){
c++;
}
}
cout<<c;
return 0;
}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | #include <iostream> using namespace std; unsigned long long l; unsigned long long r; unsigned long long c; bool check; int main(){ ios_base::sync_with_stdio(0); c=0; cin>>l>>r; for(int i=l; i<=r; i++){ check = true; unsigned long long b=1; for(int j=2; j<19; j++){ b *= 10; if(i%b == 0){ check = false; break; } if((int)((i%b)*10/b) == 0 || i%(int)((i%b)*10/b) != 0){ check = false; break; } if(i < b){ break; } } if(check){ c++; } } cout<<c; return 0; } |
English