Submission #1120505

#TimeUsernameProblemLanguageResultExecution timeMemory
1120505vjudge1Palindrome-Free Numbers (BOI13_numbers)C++17
38.33 / 100
1096 ms624 KiB
#pragma GCC optimize("-O3") #include<bits/stdc++.h> #define ll long long #define ld long double #define vl vector<ll> #define vi vector<int> #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() #define pb push_back #define sz(v) (ll)(v.size()) #define f first #define s second #define pii pair<int, int> #define pll pair<ll, ll> using namespace std; void solve() { ll a, b, i, j; cin >> a >> b; ll cnt = 0; for(i = a; i <= b; i++) { bool ok = false; string s = to_string(i); for(j = 0; j < sz(s); j++) { if(j + 1 < sz(s) && s[j] == s[j+1]) { ok = true; break; } if(j + 2 < sz(s) && s[j] == s[j+2]) { ok = true; break; } } cnt += ok; } cout << (b-a+1)-cnt << "\n"; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ll tests = 1; //cin >> tests; while(tests--) { solve(); } } /* 5 5 1 2 3 4 5 2 3 5 4 3 3 5 1 2 5 2 1 3 3 1 1 3 */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...