# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1120189 | vjudge1 | Palindrome-Free Numbers (BOI13_numbers) | C++17 | 1082 ms | 504 KiB |
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;
#define int long long
#define ld double
const int INF = 1e18;
const int mod = 12345;
const int sz = 1e5 + 5;
bool pal(string z)
{
string s = z;
reverse(s.begin() , s.end());
return z == s;
}
bool f(int x)
{
string s;
s = to_string(x);
for(int i = 0;i < s.size() - 1;i++)
{
string c = "";
c += s[i];
for(int j = i + 1;j < s.size();j++)
{
c += s[j];
if(pal(c)) return true;
}
}
return false;
}
signed main()
{
ios_base::sync_with_stdio(0);cin.tie(0);
int a , b;
cin >> a >> b;
int ans = 0;
for(int i = a;i <= b;i++)
{
if(f(i))
{
ans++;
}
}
cout << b - a + 1 - ans << endl;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |