Submission #1121032

#TimeUsernameProblemLanguageResultExecution timeMemory
1121032vjudge1Palindrome-Free Numbers (BOI13_numbers)C++17
36.67 / 100
1074 ms592 KiB
#include<bits/stdc++.h>

#define ll long long
#define pb push_back
#define in insert
#define fi first
#define se second
#define vl vector<ll>
#define all(v) v.begin(), v.end()
#define endl "\n"

using namespace std;
const int sz = 1e6 + 5; /// mind this
const int MAX = 2e6 + 123;
const int BS = 61;
const int mod = 998244353;

void solve(){
    ll a, b, i, j, ans = 0;
    cin >> a >> b;
    for(i = a; i <= b; i++){
        ll x = i;
        bool ok = 1;
        while(x >= 10){
            if (x >= 100) ok &= (x / 100) % 10 != x % 10;
            if (x >= 10) ok &= (x / 10) % 10 != x % 10;
            x /= 10;
        }
        ans += ok;
    }
    cout << ans << endl;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll t = 1;
    // cin >> t;
    while(t--){
        solve();
    }
}

/*
123 321
*/

Compilation message (stderr)

numbers.cpp: In function 'void solve()':
numbers.cpp:19:17: warning: unused variable 'j' [-Wunused-variable]
   19 |     ll a, b, i, j, ans = 0;
      |                 ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...