Submission #448489

#TimeUsernameProblemLanguageResultExecution timeMemory
448489BT21tataPalindrome-Free Numbers (BOI13_numbers)C++17
34.17 / 100
1096 ms296 KiB
#include<bits/stdc++.h> // #pragma GCC target ("avx,avx2,fma") // #pragma GCC optimize("Ofast") // #pragma GCC optimize("unroll-loops") typedef long long ll; typedef long double ld; #define SPEED ios_base::sync_with_stdio(false); cin.tie(0), cout.tie(0) #define rall(v) (v).rbegin(),(v).rend() #define all(v) (v).begin(),(v).end() #define OK cerr<<"OK"<<endl<<flush #define pii pair<int, int> #define pll pair<ll, ll> #define pb push_back #define F first #define S second #define y0 jahdakdh #define y1 jahsadakdakdh #define endl '\n' using namespace std; const ll MOD=1e9+7; // mt19937 rng(std::chrono::system_clock::now().time_since_epoch().count()); ll a, b; ll ans; bool check(int x) { string s=to_string(x); s+='-'; for(int i=0; i<(int)s.length()-2; i++) { if(s[i]==s[i+1] or s[i]==s[i+2]) return 0; } return 1; } int main() { SPEED; cin>>a>>b; for(int i=a; i<=b; i++) { ans+=check(i); } cout<<ans<<endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...