# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
121645 | sams | Palindrome-Free Numbers (BOI13_numbers) | C++14 | 1086 ms | 476 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;
typedef long long ll;
ll a, b;
//string a, b;
int check(ll a)
{
int v[20];
int t = 0;
int r = 0;
while(a > 0)
{
ll c = a%10;
t++;
v[t] = c;
a -= c;
a /= 10;
}
for(int i = 2 ; i < t; ++i)
{
//cout << v[i] << " \n"[i == t];
if(v[i-1] == v[i+1]) r = 1;
if(v[i-1] == v[i] || v[i] == v[i+1]) r = 1;
}
return r;
}
int main()
{
int resp = 0;
cin >> a >> b;
ll c = a;
while(a <= b)
{
//cout << a << '\n';
int x = check(a);
//if(x == 1) cout << a << '\n';
resp += check(a);
a++;
}
cout << b - c - resp + 1<< '\n';
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |