Submission #1294722

#TimeUsernameProblemLanguageResultExecution timeMemory
1294722JohanPalindrome-Free Numbers (BOI13_numbers)C++20
55.83 / 100
1096 ms580 KiB
#include<bits/stdc++.h> using namespace std; bool ok(int x){ string s = to_string(x); for(int i = 0; i < s.size() - 1; i++){ if(s[i] == s[i + 1] or i < s.size() - 2 && s[i] == s[i + 2]) return false; } return true; } int main(){ // freopen("input.txt", "r", stdin); // freopen("output.txt", "w", stdout); cin.tie(nullptr)->sync_with_stdio(false); int a, b, ans = 0; cin >> a >> b; for(int i = a; i <= b; i++){ if(i < 10){ans++;continue;} if(i % 10 == (i % 100) / 10)continue; ans += ok(i); } cout << ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...