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>
using namespace std;
bool is_palindrome(string s, int l, int r) {
bool check = true;
if(l >= r-1)return false;
for(int i = l;i<l + (r - l)/2;i++) {
if(s[i] != s[r - i + l - 1]) {
check = false;break;
}
}
if(check == true)return true;
return is_palindrome(s, l, r-1) | is_palindrome(s, l + 1, r);
}
int main () {
long long a, b, c = 0;
cin >> a >> b;
for(int i = a;i<=b;i++) {
string k = to_string(i);
if(!is_palindrome(k, 0, k.length())) {
c++;
}
}cout<<c<<endl;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |