#include <bits/stdc++.h>
using namespace std;
long long temp;
int main (){
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
long long r,l;
cin>>l>>r;
long long ile=0;
for (long long as=l; as<=r; as++) {
temp = as;
bool potyczkowa=1;
while (temp>0 &&potyczkowa){
if (temp%10==0) {
potyczkowa=0; break; }
if (as%(temp%10)==0) {
potyczkowa=1;
temp=(temp-(temp%10))/10; }
else
potyczkowa=0; }
if (temp==10)
potyczkowa=0;
if (potyczkowa)
ile++;}
cout<<ile;
}
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 | #include <bits/stdc++.h> using namespace std; long long temp; int main (){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long r,l; cin>>l>>r; long long ile=0; for (long long as=l; as<=r; as++) { temp = as; bool potyczkowa=1; while (temp>0 &&potyczkowa){ if (temp%10==0) { potyczkowa=0; break; } if (as%(temp%10)==0) { potyczkowa=1; temp=(temp-(temp%10))/10; } else potyczkowa=0; } if (temp==10) potyczkowa=0; if (potyczkowa) ile++;} cout<<ile; } |
English