#include <iostream>
bool isLic(long long x)
{
long long temp = x;
while(temp%10 and not (x % (temp%10)))
{
temp/=10;
}
return not temp%10;
}
int main()
{
long long x,y;
std::cin>>x>>y;
long long c = 0;
for(x; x<=y; ++x)
{
if(isLic(x)) ++c;
}
std::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 | #include <iostream> bool isLic(long long x) { long long temp = x; while(temp%10 and not (x % (temp%10))) { temp/=10; } return not temp%10; } int main() { long long x,y; std::cin>>x>>y; long long c = 0; for(x; x<=y; ++x) { if(isLic(x)) ++c; } std::cout << c; return 0; } |
English