#include <iostream>
using namespace std;
bool potyczkowa(long long &x) {
for(long long y = x; y; y /= 10)
if((y % 10) == 0 || x % (y % 10) != 0)
return false;
return true;
}
int main() {
long long a, b, result = 0;
for(cin >> a >> b; a <= b; a++)
if(potyczkowa(a))
result++;
cout << result << "\n";
return 0;
}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | #include <iostream> using namespace std; bool potyczkowa(long long &x) { for(long long y = x; y; y /= 10) if((y % 10) == 0 || x % (y % 10) != 0) return false; return true; } int main() { long long a, b, result = 0; for(cin >> a >> b; a <= b; a++) if(potyczkowa(a)) result++; cout << result << "\n"; return 0; } |
English