Submission #536125

#TimeUsernameProblemLanguageResultExecution timeMemory
536125SkurrlPalindrome-Free Numbers (BOI13_numbers)C++17
25 / 100
1095 ms320 KiB
#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define N 100005
#define MOD 1000000007
#define endl '\n'
#define all(x) x.begin(), x.end()

typedef long long int ll;

const ll inf = 1e17;

void solve()
{
    ll a, b; cin >> a >> b;

    ll cnt = 0;
    for(ll i = b; i >= a; --i)
    {
        bool ok = true;
        string s = to_string(i);

        int k = s.size();

        for(int l = 0; l < k - 1; ++l)
        {
            for(int r = l + 1; r < k; ++r)
            {
                string t = "";
                for(int j = l; j <= r; ++j) t += s[j];

                string tt = t;
                reverse(all(tt));

                ok &= (tt != t);
            }
        }

        cnt += (ok ? 1 : 0);
    }

    cout << cnt;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    //ll t; cin >> t;
    //while(t--)
        solve();
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...