This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
//#pragma GCC optimize ("O1")
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define pb push_back
#define F first
#define S second
#define ll long long
//#define int ll
#define pii pair<int, int>
#define io ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define M_PI 3.14159265358979323846
#define all(v) v.begin(), v.end()
#define pss pair<string, string>
#define no cout<<"NO"<<endl;
#define yes cout<<"YES"<<endl;
#define imp cout<<-1<<endl;
#define flu cout.flush();
#define Endl endl
const int N = 300009;
const int mod = 1e9+7;
bool pol(string s){
string q=s;
reverse(all(q));
if(q==s){
return true;
}
else{
return false;
}
}
bool haspo(int n){
string s="";
vector<int>a;
while(n>0){
a.pb(n%10);
n=n/10;
}
reverse(all(a));
for(int i : a){
s=s+char(i+48);
}
n=s.size();
for(int i=0; i<n; i++){
for(int j=i+1; j<n; j++){
string q="";
for(int k=i; k<=j; k++){
q+=s[k];
}
if(pol(q)){
return false;
}
}
}
return true;
}
void solve(){
int a, b;
cin>>a>>b;
int cnt=0;
for(int i=a; i<=b; i++){
if(haspo(i)){
cnt++;
}
}
cout<<cnt<<endl;
}
signed main(){
//io;
int t=1;
//cin>>t;
while(t--){
solve();
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |