#include <iostream>
#include <string>
using namespace std;
bool is_palindrome(const string &s, int l, int r) {
while (l < r) {
if (s[l++] != s[r--]) return false;
}
return true;
}
bool is_palindrome_free(long long x) {
string s = to_string(x);
int n = s.size();
for (int len = 2; len <= n; ++len) {
for (int i = 0; i + len <= n; ++i) {
if (is_palindrome(s, i, i + len - 1)) {
return false;
}
}
}
return true;
}
int main() {
long long a, b;
cin >> a >> b;
int count = 0;
for (long long i = a; i <= b; ++i) {
if (is_palindrome_free(i)) {
count++;
}
}
cout << count << endl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |