#include <iostream>
using namespace std;
bool gowno(long long n)
{
long long m=n;
while(m>0)
{
int a=m%10;
if(a==0) return false;
if(n%a!=0) return false;
m/=10;
}
return true;
}
int main()
{
long long x, y, w=0;
std::ios_base::sync_with_stdio(0);
cin>>x>>y;
for(long long i=x;i<=y;i++)
{
if(gowno(i))
{
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 24 25 26 27 28 29 30 | #include <iostream> using namespace std; bool gowno(long long n) { long long m=n; while(m>0) { int a=m%10; if(a==0) return false; if(n%a!=0) return false; m/=10; } return true; } int main() { long long x, y, w=0; std::ios_base::sync_with_stdio(0); cin>>x>>y; for(long long i=x;i<=y;i++) { if(gowno(i)) { w++; } } cout<<w; return 0; } |
English