제출 #966227

#제출 시각아이디문제언어결과실행 시간메모리
9662273laaPalindrome-Free Numbers (BOI13_numbers)C++14
36.67 / 100
1077 ms600 KiB
//freopen(".in","r",stdin);freopen(".out","w",stdout);
#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#include <bits/stdc++.h>
#include <unordered_map>
#define endl '\n'
#define mid ((l+r)/2)
#define  F first
#define  S second
#define pb push_back
#define yes void (cout<<"YES"<<endl)
#define no void (cout<<"NO"<<endl)
#define ump unordered_map <ll,ll>
#define sp " "
#define vll vector<ll>
#define vint vector<int>
#define vp vector<pll>
#define pll pair<ll,ll>
#define mem(x,val) memset(x,val,sizeof(x))
typedef long double ld;
typedef long long ll;
using namespace std;
const ll inf=2e18+9;
const ll M=1e9+7;
ll a,b,ans;
bool check(ll num){
    string s=to_string(num);
    ll n=s.size();
    s+="*?";
    for(ll i=0 ; i<n ;i++)
        if(s[i]==s[i+1]||s[i]==s[i+2])
            return 0;
    return 1;
}
void solve(){
    cin>>a>>b;
    for(ll i=a ; i<=b  ;i++)
        ans+=check(i);
    cout<<ans<<endl;
}
int main(){
    fast;
    ll tt=1;
    //cin>>tt;
    while(tt--)solve();
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...