# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1120197 | vjudge1 | Palindrome-Free Numbers (BOI13_numbers) | C++17 | 1090 ms | 512 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;
for(intt cur = a; cur <= b; cur++) {
string s = to_string(cur);
bool ok = true;
for(intt i = 0; i < s.size(); i++) {
for(intt j = i + 1; j < s.size(); j++) {
string t = "";
for(intt k = i; k <= j; k++) t += s[k];
string c = t;
reverse(ALL(c));
if(c == t) {
ok = false;
break;
}
}
if(!ok) break;
}
ans += ok;
}
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... |