| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1120295 | vjudge1 | Palindrome-Free Numbers (BOI13_numbers) | C++17 | 1098 ms | 39592 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 int long long
unordered_set<int> st;
int lf,rf;
bool da(int a){
vector<int> sira;
while(a){
sira.push_back(a % 10);
a /= 10;
}
int l=0,r=sira.size() - 1;
while(l < r){
if(sira[l] != sira[r])return 0;
l++;
r--;
}
return 1;
}
void qur(int a,int cnt){
if(a > rf)return;
if(lf <= a)st.insert(a);
for(int i=0;i<=9;++i){
qur(a * 10 + i,cnt+1);
if(i){
qur(i * pow(10,cnt) + a,cnt+1);
}
}
}
bool check(int a){
vector<int> sira;
while(a){
sira.push_back(a % 10);
a /= 10;
}
for(int i=0;i<sira.size();++i){
vector<int> temp;
temp.push_back(sira[i]);
for(int j=i+1;j<sira.size();++j){
bool nuhuh = 0;
temp.push_back(sira[j]);
int l=0,r= temp.size() - 1;
while(l <= r){
if(temp[l] != temp[r]){
nuhuh = 1;
break;
}
l++;
r--;
}
if(nuhuh)continue;
return 0;
}
}
return 1;
}
signed main(){
int a,b;
cin >> a >> b;
lf = a;
rf = b;
int cnt=2;
for(int i=11;i<=999;++i){
if(i >= 100)cnt = 3;
if(da(i) || i % 100 == 0){
qur(i,cnt);
}
}
cout << rf - lf + 1 - st.size();
}Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
