# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1120244 | vjudge1 | Palindrome-Free Numbers (BOI13_numbers) | C++17 | 1086 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
bool ok(string s)
{
string scc;
for(int i = 0; i < s.size() - 1; i++)
{
for(int j = i + 1; j < s.size(); j++)
{
string sc = "";
for(int z = i; z <= j; z++)
sc += s[z];
scc = sc;
reverse(scc.begin(), scc.end());
if(sc == scc){
return 1;
}
}
}
return 0;
}
void solve()
{
string s;
int a, b, cnt = 0;
cin >> a >> b;
for(int i = a; i <= b; i++)
{
s = to_string(i);
if(ok(s))
{
cnt++;
}
}
cout << (b - a + 1) - cnt << endl;
}
signed main()
{
int tt = 1;
// cin >> tt;
while(tt--)
solve();
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |