# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1120344 | vjudge1 | Palindrome-Free Numbers (BOI13_numbers) | C++17 | 1088 ms | 508 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 SPEED \
ios_base::sync_with_stdio(0); \
cin.tie(NULL); \
cout.tie(NULL);
#define pb push_back
#define endl "\n"
#define ALL(x) x.begin(), x.end()
#define intt long long
const intt mxN = 2e5 + 5;
void solve() {
intt a, b;
cin >> a >> b;
intt ans = 0;
vector<intt> arr;
for(intt cur = a; cur <= b; cur++) {
intt eded = cur;
vector<intt>hmm;
while(eded) {
hmm.pb(eded % 10);
eded /= 10;
}
if(hmm.size() == 1) continue;
if(hmm.size() == 2) continue;
if(hmm.size() == 3) {
if(hmm[0] == hmm[1] || hmm[1] == hmm[2] || hmm[0] == hmm[2]) {
continue;
} else {
ans++;
continue;
}
}
for(intt i = 1; i < hmm.size(); i++) {
if(hmm[i] == hmm[i-1]) {
continue;
}
}
bool ok = true;
for(intt i = 0; i < hmm.size(); i++) {
for(intt j = i + 1; j < hmm.size(); j++) {
intt ind = 0;
bool is = true;
while(i + ind < j - ind) {
if(hmm[i + ind] != hmm[j-ind]){
is = false;
break;
}
ind++;
}
if(is) {
ok = false;
break;
}
}
if(!ok) break;
}
if(ok){
ans++;
}
}
cout << ans << endl;
}
int main(){
SPEED;
int tst = 1, i = 1;
// cin >> tst;
while(tst--) {
solve();
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |