This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
bool check(long long s) {
long long prev = -1, pprev = -2;
while(s > 0) {
if(s%10 == prev or s%10 == pprev)return false;
pprev = prev;
prev = s%10;
s/=10;
}
return true;
}
int main () {
long long a, b, c = 0;
cin >> a >> b;
for(long long i = a;i<=b;i++) {
if(check(i))c++;
}
cout<<c;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |