이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |