Submission #486782

#TimeUsernameProblemLanguageResultExecution timeMemory
486782NintsiChkhaidzePalindrome-Free Numbers (BOI13_numbers)C++14
38.33 / 100
1094 ms312 KiB
#include <bits/stdc++.h>
#define pb push_back
#define s second
#define f first
#define ll long long
#define int ll
using namespace std;

signed main (){
    ios_base::sync_with_stdio(NULL),cin.tie(NULL),cout.tie(NULL);
    
    int a,b,ans=0;
    cin>>a>>b;

    for (int i = a; i <= b; i++){
        int x = i,last = -1,last2 = -1,q=1;
        while(x){
            int y = x%10;
            if (y == last || y == last2){
                q=0;
                break;
            }
            x/=10;
            last2 = last;
            last = y;
        }
        if (q) ans++;
    }
    cout<<ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...