#include <iostream> #include <vector> #include <cstring> using namespace std; int main() { std::ios_base::sync_with_stdio(0); unsigned long long w=0; unsigned long long n,m; cin>>n>>m; for(unsigned long long i=n;i<=m;i++) {bool git=1; int a=i; while(a) {if(a%10==0||i%(a%10))git=0; a/=10; } if(git){w++;} } cout<<w; 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 | #include <iostream> #include <vector> #include <cstring> using namespace std; int main() { std::ios_base::sync_with_stdio(0); unsigned long long w=0; unsigned long long n,m; cin>>n>>m; for(unsigned long long i=n;i<=m;i++) {bool git=1; int a=i; while(a) {if(a%10==0||i%(a%10))git=0; a/=10; } if(git){w++;} } cout<<w; return 0; } |