#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define int long long
#define ll long long
#define ull unsigned long long
#define lb lower_bound
#define ub upper_bound
#define IOS ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
int gcd(int a, int b){
return __gcd(a, b);
}
int lcm(int a, int b){
return a / gcd(a, b) * b;
}
int dx[] = {-1, 1, 0, 0};
int dy[] = {0, 0, -1, 1};
bool sth(string &s){
for (int i = 0; i < s.size(); i++){
for (int j = i + 1; j < s.size(); j++){
bool ok = true;
int l = i, r = j;
while(l < r){
if(s[l] != s[r]){
ok = false;
break;
}
l++;
r--;
}
if(ok)return false;
}
}
return true;
}
void solve(){
int a, b;
cin >> a >> b;
int ans = 0;
for (int i = a; i <= b; i++){
string s = to_string(i);
if(sth(s)){
ans++;
}
}
cout << ans << endl;
}
signed main(){
IOS;
int t = 1;
//cin >> t;
while (t--){
solve();
}
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |