#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
#define yes cout << "Yes" << "\n"
#define no cout << "No" << "\n"
#define pb push_back
#define F first
#define S second
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair <int, int> pii;
typedef vector <pii> vii;
typedef vector <ll> vi;
typedef vector <vi> vvi;
template<typename T>
void read(vector<T>& v) {
for (auto &x : v) cin >> x;
}
template<typename T>
void print(const vector<T>& v) {
for (auto &x : v) cout << x << ' ';
cout << "\n";
}
const ll MAX = 1e6 + 5;
const ll MOD = 1e9 + 7;
void solve() {
ll l, r;
cin >> l >> r;
int say = 0;
for (ll i = l; i <= r; i++) {
ll d = i;
string s = "";
while (d) {
s += (d % 10) + '0';
d /= 10;
}
reverse(all(s));
bool ok = true;
for (int j = 0; j < s.size(); j++) {
for (int k = j + 1; k < s.size(); k++) {
string s1 = s.substr(j, k - j + 1);
string s2 = s1;
reverse(all(s2));
if (s2 == s1) {
ok = false;
}
}
}
if (ok) {
say++;
}
}
cout << say << "\n";
}
signed main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int t = 1;
//cin >> t;
for (int i = 1; i <= t; i++) {
solve();
}
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |