답안 #102337

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
102337 2019-03-24T11:01:49 Z MoNsTeR_CuBe Palindrome-Free Numbers (BOI13_numbers) C++17
31.6667 / 100
1000 ms 504 KB
#include <bits/stdc++.h>
using namespace std;

#define int long long

bool check(string a){
    for(int i = 0; i < (int)a.size()-1; i++){
        if(a[i] == a[i+1]) return false;
    }
    for(int i = 0; i < (int)a.size()-2; i++){
        if(a[i] == a[i+2]) return false;
    }
    return true;
}

string toString(int a){
    if(a == 0) return "0";
    string s = "";
    while(a){
        s = ((char)(a%10+'0'))+s;
        a/=10;
    }
    return s;
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a;
    int b;
    cin >> a;
    cin >> b;
    int tot = 0;
    while(a <= b){
        if(check(toString(a))){
            tot++;
        }
        a++;
    }
    cout << tot << endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 30 ms 376 KB Output is correct
4 Correct 11 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 356 KB Output is correct
8 Correct 3 ms 384 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 2 ms 256 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 12 ms 256 KB Output is correct
15 Correct 10 ms 384 KB Output is correct
16 Correct 2 ms 384 KB Output is correct
17 Correct 5 ms 384 KB Output is correct
18 Correct 2 ms 384 KB Output is correct
19 Correct 29 ms 384 KB Output is correct
20 Correct 10 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1057 ms 256 KB Time limit exceeded
2 Execution timed out 1065 ms 384 KB Time limit exceeded
3 Execution timed out 1074 ms 256 KB Time limit exceeded
4 Execution timed out 1064 ms 384 KB Time limit exceeded
5 Execution timed out 1067 ms 384 KB Time limit exceeded
6 Execution timed out 1081 ms 256 KB Time limit exceeded
7 Correct 388 ms 504 KB Output is correct
8 Correct 257 ms 376 KB Output is correct
9 Correct 537 ms 376 KB Output is correct
10 Correct 719 ms 384 KB Output is correct
11 Execution timed out 1067 ms 504 KB Time limit exceeded
12 Execution timed out 1068 ms 256 KB Time limit exceeded
13 Execution timed out 1075 ms 256 KB Time limit exceeded
14 Execution timed out 1076 ms 384 KB Time limit exceeded
15 Execution timed out 1067 ms 384 KB Time limit exceeded
16 Execution timed out 1070 ms 384 KB Time limit exceeded
17 Execution timed out 1075 ms 384 KB Time limit exceeded
18 Execution timed out 1047 ms 384 KB Time limit exceeded
19 Execution timed out 1059 ms 256 KB Time limit exceeded
20 Execution timed out 1069 ms 384 KB Time limit exceeded
21 Execution timed out 1068 ms 384 KB Time limit exceeded
22 Execution timed out 1067 ms 384 KB Time limit exceeded
23 Execution timed out 1075 ms 384 KB Time limit exceeded
24 Execution timed out 1070 ms 256 KB Time limit exceeded
25 Execution timed out 1069 ms 256 KB Time limit exceeded
26 Execution timed out 1084 ms 384 KB Time limit exceeded
27 Execution timed out 1006 ms 384 KB Time limit exceeded
28 Execution timed out 1049 ms 256 KB Time limit exceeded
29 Execution timed out 1076 ms 384 KB Time limit exceeded
30 Execution timed out 1067 ms 384 KB Time limit exceeded
31 Execution timed out 1065 ms 384 KB Time limit exceeded
32 Execution timed out 1083 ms 384 KB Time limit exceeded
33 Execution timed out 1075 ms 384 KB Time limit exceeded
34 Execution timed out 1072 ms 384 KB Time limit exceeded
35 Execution timed out 1064 ms 384 KB Time limit exceeded
36 Execution timed out 1056 ms 384 KB Time limit exceeded
37 Execution timed out 1070 ms 384 KB Time limit exceeded
38 Execution timed out 1079 ms 384 KB Time limit exceeded
39 Execution timed out 1067 ms 384 KB Time limit exceeded
40 Execution timed out 1066 ms 384 KB Time limit exceeded
41 Execution timed out 1048 ms 256 KB Time limit exceeded
42 Execution timed out 1084 ms 384 KB Time limit exceeded
43 Execution timed out 1079 ms 384 KB Time limit exceeded
44 Execution timed out 1072 ms 256 KB Time limit exceeded
45 Execution timed out 1067 ms 384 KB Time limit exceeded