Submission #604256

#TimeUsernameProblemLanguageResultExecution timeMemory
604256shezittPalindrome-Free Numbers (BOI13_numbers)C++14
36.67 / 100
1098 ms332 KiB
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> ii; typedef long double ld; #define lcm(a,b) a*b/__gcd(a,b) #define INF 1000000000 #define pb push_back #define fst first #define snd second #define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); #define fore(a, b, c) for(int a=b; a<c; ++a) #define all(x) x.begin(), x.end() #define dbg(x) cerr << #x << ": " << x << endl; #define raya cerr << "=================================" << endl; const double PI = 3.141592653589793; const int MOD = 1e9+7; // 25 points bool free(string s){ int n = s.size(); for(int i=1; i<n; ++i){ if(s[i] == s[i-1]){ return 0; } } for(int i=1; i+1<n; ++i){ if(s[i-1] == s[i+1]){ return 0; } } return 1; } int main(){ ll a, b, ans = 0; cin >> a >> b; for(ll i=a; i<=b; ++i){ ans += free(to_string(i)); } cout << ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...