# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
493471 | goodluck2020 | Palindrome-Free Numbers (BOI13_numbers) | C++14 | 70 ms | 316 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define task "numbers"
#define sz(X) ((int)X.size())
using namespace std;
int L, R;
struct
{
bool PalinFree(long long k)
{
string S;
stringstream ss;
ss << k;
ss >> S;
for(int i = 1; i < sz(S); i++)
{
if(S[i] == S[i-1]) return 0;
if(i > 1 && S[i] == S[i-2]) return 0;
}
return 1;
}
void solve()
{
int ans = 0;
for(long long i = L; i <= R; i++)
if(PalinFree(i)) ans++;
cout << ans;
}
} sub1;
int main()
{
if(fopen(task ".inp","r"))
{
freopen(task ".inp","r",stdin);
freopen(task ".out","w",stdout);
}
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cin >> L >> R;
if(R - L <= 1e5) sub1.solve();
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |