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>
#define GOOD_LUCK ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define int long long
#define itn int
#define Int int
#define INF -1000000
#define MOD 1000000007
#define endl "\n"
#define ff first
#define ss second
#define all(v) v.begin(), v.end()
using namespace std;
int temp;
bool check(int n) {
string a = to_string(n);
string c = a;
int x = a.size();
string b = a;
reverse(b.begin(), b.end());
string d = b;
if (a == b) return false;
for (int i=1; i < x-1; i++) {
a = a.substr(1);
b = b.substr(0, x - i);
if (a == b) return false;
}
a = c;
b = d;
for (int i=1; i < x-1; i++) {
d = d.substr(1);
c = c.substr(0, x - i);
if (c == d) return false;
}
return true;
}
signed main() {
GOOD_LUCK
int t;
t = 1;
// cin >> t;
while (t--) {
int a, b;
cin >> a >> b;
int cnt=0;
for (int i=a; i <= b; i++) {
if (check(i)) cnt++;
}
cout << cnt;
}
return 0;
}
// Problem C
// by Ekber_Ekber
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |