이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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;
cin >> 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
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |