#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define vec vector
#define pb push_back
#define pll array<ll, 2>
#define ss second
#define ff first
#define all(X) X.begin(), X.end()
#define allr(X) X.rbegin(), X.rend()
using namespace std;
const ll inf = 1e18;
void _(){
ll a, b , ans = 0; cin >> a >> b;
for(ll i = a; i <= b; i++){
bool add = 1;
string s = to_string(i);
for(ll j = 1; j < s.size(); j++){
if(s[j - 1] == s[j] or (j > 1 and s[j - 2] == s[j])) {add = 0; break;}
}
ans += add;
} cout << ans;
}
signed main(){
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0); _();
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |