#include<iostream> using namespace std; int main(){unsigned long long int suma=0; unsigned long long int x,y; cin>>x>>y; unsigned long long int n=y-x+1; unsigned long long int k=x; unsigned long long int T[n]; for(unsigned long long int i=0;i<n;i++){ T[i]=k; k++; } unsigned long long int z; int r; int o=0; for(unsigned long long int i=0;i<n;i++){ z=T[i]; for(;z>0;){ r=z%10; z=z/10; if(r==0){o++; continue;} if(T[i]%r!=0){o++; } } if(o!=0){o=0;continue; } o=0; suma++; } cout<<suma; 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 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | #include<iostream> using namespace std; int main(){unsigned long long int suma=0; unsigned long long int x,y; cin>>x>>y; unsigned long long int n=y-x+1; unsigned long long int k=x; unsigned long long int T[n]; for(unsigned long long int i=0;i<n;i++){ T[i]=k; k++; } unsigned long long int z; int r; int o=0; for(unsigned long long int i=0;i<n;i++){ z=T[i]; for(;z>0;){ r=z%10; z=z/10; if(r==0){o++; continue;} if(T[i]%r!=0){o++; } } if(o!=0){o=0;continue; } o=0; suma++; } cout<<suma; return 0; } |