이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
bool is_palindrome(string s, int l, int r) {
bool check = true;
if(l >= r-1)return false;
for(int i = l;i<l + (r - l)/2;i++) {
if(s[i] != s[r - i + l - 1]) {
check = false;break;
}
}
if(check == true)return true;
return is_palindrome(s, l, r-1) | is_palindrome(s, l + 1, r);
}
int main () {
long long a, b, c = 0;
cin >> a >> b;
for(int i = a;i<=b;i++) {
string k = to_string(i);
if(!is_palindrome(k, 0, k.length())) {
c++;
}
}cout<<c<<endl;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |