#include <bits/stdc++.h> using namespace std; long long help[10]; bool potycz(long long x){ //cout << "jkdsf" << endl; long long puf=x; while(puf>0){ int digit=puf%10; if(digit==0)return false; help[digit]=x; if(x%digit!=0)return false; puf/=10; } //cout << x << endl; return true; } int main(){ ios_base::sync_with_stdio(0); cin.tie(0); long long l,r; int result=0; cin >> l >> r; for(long long i=l;i<=r;i++){ if(potycz(i)==true)result++; } cout << result << "\n"; 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 | #include <bits/stdc++.h> using namespace std; long long help[10]; bool potycz(long long x){ //cout << "jkdsf" << endl; long long puf=x; while(puf>0){ int digit=puf%10; if(digit==0)return false; help[digit]=x; if(x%digit!=0)return false; puf/=10; } //cout << x << endl; return true; } int main(){ ios_base::sync_with_stdio(0); cin.tie(0); long long l,r; int result=0; cin >> l >> r; for(long long i=l;i<=r;i++){ if(potycz(i)==true)result++; } cout << result << "\n"; return 0; } |