# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1120839 | vjudge1 | Palindrome-Free Numbers (BOI13_numbers) | C++17 | 1088 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"
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
#define pb push_back
#define in insert
#define F first
#define S second
#define vll vector<ll>
#define all(v) v.begin(),v.end()
#define endl '\n'
#define pii pair<ll,ll>
using namespace std;
const ll INF =1e18, mod = 1e9 + 7, N = 1e5 + 5;
bool free(ll n){
string s = to_string(n);
for(int i = 0; i < s.size(); i++){
for(int j = i + 1; j < s.size(); j++){
string neww = s.substr(i, j - i + 1);
string e = neww;
reverse(all(neww));
if(neww == e){
return false;
}
}
}
return true;
}
void solve(){
ll a,b;
cin >> a >> b;
ll cnt = 0;
for(ll i = a; i <= b; i++){
if(free(i)){
cnt++;
}
}
cout << cnt << endl;
}
int main(){
fast;
solve();
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |