#include <iostream>
int main(){
int beg, end, temp, i;
i = 0;
std::cin >> beg >> end;
do{
if(beg < 10){
++i;
continue;
}
temp = beg;
do{
if(!(temp % 10) || beg % (temp % 10) != 0)
break;
}while(temp /= 10);
if(!temp)
++i;
}while(beg++ < end);
std::cout << i << std::endl;
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 | #include <iostream> int main(){ int beg, end, temp, i; i = 0; std::cin >> beg >> end; do{ if(beg < 10){ ++i; continue; } temp = beg; do{ if(!(temp % 10) || beg % (temp % 10) != 0) break; }while(temp /= 10); if(!temp) ++i; }while(beg++ < end); std::cout << i << std::endl; return 0; } |
English