Submission #1295078

#TimeUsernameProblemLanguageResultExecution timeMemory
1295078ako_aqsinPalindrome-Free Numbers (BOI13_numbers)C++20
25 / 100
1097 ms576 KiB
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define f first
#define s second
#define pb push_back
#define yes cout << "yes" << endl;
#define YES cout << "YES" << endl;
#define no cout << "no" << endl;
#define NO cout << "NO" << endl;
bool ispal(string s){
    string h = s;
    reverse(h.begin(), h.end());
    bool ko = true;
    for(int i = 0; i < s.size(); i++){
        if(s[i] != h[i]) ko = false;
    }
    return ko;
}
void never_give_up() {
    int n;
    //cin >> n;
    string l = "133";
    if(ispal(l)){
        //cout << "hee" << endl;
    }
    else{
        //cout << "yook" << endl;
    }
    int a, b, c = 0, d = 0;
    cin >> a >> b;
    for(int k = a; k <= b; k++){
        string s = to_string(k);
        bool ok = true;
        n = s.size();
        for(int i = 0; i < n; i++){
            if(ok){
                for(int j = i + 1; j < n; j++){
                    if(ok){
                        string f = "";
                        for(int ha = i; ha <= j; ha++){
                            f = f + s[ha];
                        }
                        if(ispal(f) && i != j){
                            ok = false;
                        }
                    }
                    else{
                        break;
                    }
                    
                }
            }
            else{
                break;
            }
        }
        if(ok){
            c++;
            //cout << s << endl;
        }
        
    }
    cout << c << endl;
}
void You_can_do_it() {
    
}
signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int THE_wasd = 1;               
    //cin >> THE_wasd;
    while(THE_wasd--){
        never_give_up();
        //You_can_do_it();
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...