제출 #1288562

#제출 시각아이디문제언어결과실행 시간메모리
1288562Faisal_SaqibPalindrome-Free Numbers (BOI13_numbers)C++20
38.33 / 100
1097 ms588 KiB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
bool check(ll x)
{
    string s=to_string(x);
    for(int i=0;i<s.size();i++)
    {
      if(i>0 and s[i]==s[i-1])return 0;
      if(i>1 and s[i-2]==s[i])return 0;
    }
    return 1;
}
// set<string> pre[100];
int main()
{
    
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(0);
    cout.tie(0);cin.tie(0);
    ll a,b,cnt=0;
    cin>>a>>b;
    for(ll x=a;x<=b;x++)
    {
        if(check(x))
        {
            cnt++;
        }
    }
    cout<<cnt<<endl;
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...