////////////////////////////// Author:eldaee, coder_viper
#pragma GCC optimize ("Ofast")
#include <bits/stdc++.h>
#define int long long
#define str string
#define vec vector
#define dou double
#define ld long double
#define pb push_back
#define ppb pop_back
#define eb emplace_back
#define YES cout << "YES" << '\n'
#define Yes cout << "Yes" << '\n'
#define NO cout << "NO" << '\n'
#define No cout << "No" << '\n'
#define gcd __gcd
#define all(x) x.begin(),x.end()
#define eldaee ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
/*
*/
void solve() {
int a, b;
cin >> a >> b;
int ans = 0;
for (int i = a; i <= b; i++) {
str s = to_string(i);
int n = (int) s.size();
bool fl = true;
for (int j = 1; j < n; j++) {
if (s[j] == s[j - 1]) {
fl = false;
break;
}
}
for (int j = 2; j < n &&& fl; j++) {
if (s[j] == s[j - 2]) {
fl = false;
break;
}
}
if (fl) {
ans++;
}
}
cout << ans << '\n';
}
signed main()
{
eldaee
solve();
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |