답안 #493472

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
493472 2021-12-11T14:18:25 Z goodluck2020 Palindrome-Free Numbers (BOI13_numbers) C++14
25 / 100
67 ms 288 KB
#include <bits/stdc++.h>
#define task "numbers"
#define sz(X) ((int)X.size())
using namespace std;
long long 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();
}

Compilation message

numbers.cpp: In function 'int main()':
numbers.cpp:33:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   33 |         freopen(task ".inp","r",stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
numbers.cpp:34:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   34 |         freopen(task ".out","w",stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 64 ms 204 KB Output is correct
4 Correct 55 ms 284 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 49 ms 284 KB Output is correct
15 Correct 49 ms 288 KB Output is correct
16 Correct 2 ms 204 KB Output is correct
17 Correct 17 ms 204 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
19 Correct 67 ms 284 KB Output is correct
20 Correct 51 ms 284 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Incorrect 1 ms 204 KB Output isn't correct
3 Incorrect 1 ms 204 KB Output isn't correct
4 Incorrect 1 ms 204 KB Output isn't correct
5 Incorrect 0 ms 204 KB Output isn't correct
6 Incorrect 0 ms 204 KB Output isn't correct
7 Incorrect 0 ms 204 KB Output isn't correct
8 Incorrect 0 ms 204 KB Output isn't correct
9 Incorrect 1 ms 204 KB Output isn't correct
10 Incorrect 0 ms 204 KB Output isn't correct
11 Incorrect 1 ms 204 KB Output isn't correct
12 Incorrect 0 ms 204 KB Output isn't correct
13 Incorrect 0 ms 204 KB Output isn't correct
14 Incorrect 0 ms 204 KB Output isn't correct
15 Incorrect 1 ms 204 KB Output isn't correct
16 Incorrect 0 ms 204 KB Output isn't correct
17 Incorrect 0 ms 204 KB Output isn't correct
18 Incorrect 0 ms 204 KB Output isn't correct
19 Incorrect 0 ms 204 KB Output isn't correct
20 Incorrect 0 ms 204 KB Output isn't correct
21 Incorrect 0 ms 204 KB Output isn't correct
22 Incorrect 0 ms 204 KB Output isn't correct
23 Incorrect 0 ms 204 KB Output isn't correct
24 Incorrect 0 ms 204 KB Output isn't correct
25 Incorrect 1 ms 204 KB Output isn't correct
26 Incorrect 1 ms 204 KB Output isn't correct
27 Incorrect 0 ms 204 KB Output isn't correct
28 Incorrect 0 ms 204 KB Output isn't correct
29 Incorrect 0 ms 204 KB Output isn't correct
30 Incorrect 1 ms 204 KB Output isn't correct
31 Incorrect 1 ms 256 KB Output isn't correct
32 Incorrect 0 ms 204 KB Output isn't correct
33 Incorrect 0 ms 204 KB Output isn't correct
34 Incorrect 0 ms 204 KB Output isn't correct
35 Incorrect 0 ms 204 KB Output isn't correct
36 Incorrect 1 ms 204 KB Output isn't correct
37 Incorrect 0 ms 204 KB Output isn't correct
38 Incorrect 0 ms 204 KB Output isn't correct
39 Incorrect 0 ms 204 KB Output isn't correct
40 Incorrect 0 ms 204 KB Output isn't correct
41 Incorrect 0 ms 204 KB Output isn't correct
42 Incorrect 0 ms 204 KB Output isn't correct
43 Incorrect 0 ms 204 KB Output isn't correct
44 Incorrect 0 ms 204 KB Output isn't correct
45 Incorrect 0 ms 204 KB Output isn't correct