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;
typedef long long ll;
typedef pair<int, int> ii;
typedef long double ld;
#define lcm(a,b) a*b/__gcd(a,b)
#define INF 1000000000
#define pb push_back
#define fst first
#define snd second
#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fore(a, b, c) for(int a=b; a<c; ++a)
#define all(x) x.begin(), x.end()
#define dbg(x) cerr << #x << ": " << x << endl;
#define raya cerr << "=================================" << endl;
const double PI = 3.141592653589793;
const int MOD = 1e9+7;
// 25 points
bool free(string s){
int n = s.size();
for(int i=1; i<n; ++i){
if(s[i] == s[i-1]){
return 0;
}
}
for(int i=1; i+1<n; ++i){
if(s[i-1] == s[i+1]){
return 0;
}
}
return 1;
}
int main(){
ll a, b, ans = 0;
cin >> a >> b;
for(ll i=a; i<=b; ++i){
ans += free(to_string(i));
}
cout << ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |