Submission #1295097

#TimeUsernameProblemLanguageResultExecution timeMemory
1295097hasanPalindrome-Free Numbers (BOI13_numbers)C++20
26.67 / 100
1097 ms588 KiB
#include <bits/stdc++.h>
using namespace std;

#define endl '\n'
#define int int_fast32_t
#define ll int_fast64_t
#define dll long double
#define ull uint_fast64_t
#define spektar this_thread::sleep_for(chrono::milliseconds(1000))

void solve(){
    ll a,b;
    cin >> a >> b;
    int ss=0;
    for(ll i=a; i<=b; i++){
        string s=to_string(i);
        bool ka=true;
        for(int j=0; j<s.size(); j++){
            int jj=j;
            deque<char> s1;
            deque<char> s2;
            while(jj<s.size() && jj<=2+j){
                s1.push_back(s[jj]);
                s2.push_front(s[jj]);
                jj++;
                if(s1.size()>=2 && s1==s2){
                    ka=false;
                    break;
                }
            }
            if(!ka) break;
        }
        if(ka) ss++;
    }
    cout << ss << endl;
}

signed main(){
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    int t=1;
    //cin >> t;
    while(t--){
        solve();
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...