This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
//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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |