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 check(string a)
{
int n = a.size();
for(int i = 0; i < n - 1; i++)
{
for(int p = i + 1; p < n; p++)
{
bool ok = true;
for(int j = 0; j <= (p - i)/2; j++)
{
//cout << i << " " << p << " " << j <<"\n";
if(a[i + j] != a[p - j]) ok = false;
}
if(ok) return true;
}
}
return false;
}
int main()
{
long long a, b;
cin >> a >> b;
int cont = 0;
for(long long i = a; i <= b; i++)
{
string x = to_string(i);
bool t = check(x);
//cout << x << " " << t << "\n";
if(t) cont++;
}
cout << b - a + 1 - cont << "\n";
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |