# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1120485 | vjudge1 | Palindrome-Free Numbers (BOI13_numbers) | C++11 | 1094 ms | 592 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>
#define GOOD_LUCK ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define int long long
#define itn int
#define Int int
#define INF -1000000
#define MOD 1000000007
#define endl "\n"
#define ff first
#define ss second
#define all(v) v.begin(), v.end()
using namespace std;
int temp;
vector <vector<int>> dp;
bool pnd(string a) {
string b = a;
reverse(a.begin(), a.end());
return (a == b);
}
bool sub_pnd(string a, int x, int y) {
int k=0, m = (x + y - 1) / 2;
while (k <= m - x) {
if (a[x+k] != a[y -k]) return false;
k++;
}
return true;
}
bool check(int n) {
string a = to_string(n);
int x = a.size();
for (int i=0; i < x-1; i++) {
for (int j=i+1; j < x; j++) {
if (sub_pnd(a, i, j)) return false;
}
}
return true;
}
signed main() {
GOOD_LUCK
int t;
t = 1;
// cin >> t;
while (t--) {
int a, b;
scanf("%d%d", &a, &b);
int cnt=0;
for (int i=a; i <= b; i++) {
if (check(i)) cnt++;
}
cout << cnt;
}
return 0;
}
// Problem C
// by Ekber_Ekber
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |