답안 #121643

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
121643 2019-06-26T21:40:48 Z sams Palindrome-Free Numbers (BOI13_numbers) C++14
13.3333 / 100
1000 ms 508 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
ll a, b;
//string a, b;

int check(ll a)
{
	int v[20];
	int t = 0;
	int r = 0;
	while(a > 0)
	{
		ll c = a%10;
		t++;
		v[t] = c;
		a -= c;
		a /= 10;
	}

	for(int i = 1 ; i <= t; ++i)
	{
		//cout << v[i] << " \n"[i == t];
		if(v[i-1] == v[i+1]) r = 1;
		if(v[i-1] == v[i] || v[i] == v[i+1]) r = 1;
	}

	return r;
}

int main()
{
	int resp = 0;
	cin >> a >> b;
	ll c = a;
	while(a <= b)
	{
		//cout << a << '\n';
		int x = check(a);
		//if(x == 1) cout << a << '\n';
		resp += check(a);
		a++;
	}
	cout << b - c - resp + 1<< '\n';
}

Compilation message

numbers.cpp: In function 'int main()':
numbers.cpp:41:7: warning: unused variable 'x' [-Wunused-variable]
   int x = check(a);
       ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Incorrect 2 ms 384 KB Output isn't correct
3 Correct 12 ms 384 KB Output is correct
4 Incorrect 4 ms 384 KB Output isn't correct
5 Incorrect 2 ms 384 KB Output isn't correct
6 Incorrect 2 ms 256 KB Output isn't correct
7 Incorrect 2 ms 256 KB Output isn't correct
8 Incorrect 2 ms 256 KB Output isn't correct
9 Incorrect 2 ms 384 KB Output isn't correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Incorrect 5 ms 384 KB Output isn't correct
15 Incorrect 4 ms 256 KB Output isn't correct
16 Incorrect 2 ms 384 KB Output isn't correct
17 Correct 3 ms 384 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
19 Correct 12 ms 400 KB Output is correct
20 Incorrect 4 ms 384 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Correct 347 ms 508 KB Output is correct
2 Execution timed out 1068 ms 256 KB Time limit exceeded
3 Execution timed out 1079 ms 256 KB Time limit exceeded
4 Execution timed out 1076 ms 384 KB Time limit exceeded
5 Execution timed out 1076 ms 384 KB Time limit exceeded
6 Execution timed out 1078 ms 384 KB Time limit exceeded
7 Incorrect 116 ms 388 KB Output isn't correct
8 Incorrect 84 ms 384 KB Output isn't correct
9 Incorrect 150 ms 256 KB Output isn't correct
10 Incorrect 209 ms 384 KB Output isn't correct
11 Correct 339 ms 384 KB Output is correct
12 Execution timed out 1082 ms 384 KB Time limit exceeded
13 Incorrect 327 ms 384 KB Output isn't correct
14 Execution timed out 1074 ms 256 KB Time limit exceeded
15 Execution timed out 1081 ms 256 KB Time limit exceeded
16 Execution timed out 1054 ms 256 KB Time limit exceeded
17 Execution timed out 1078 ms 384 KB Time limit exceeded
18 Execution timed out 1080 ms 256 KB Time limit exceeded
19 Execution timed out 1081 ms 256 KB Time limit exceeded
20 Execution timed out 1076 ms 256 KB Time limit exceeded
21 Execution timed out 1072 ms 384 KB Time limit exceeded
22 Execution timed out 1071 ms 256 KB Time limit exceeded
23 Execution timed out 1068 ms 256 KB Time limit exceeded
24 Execution timed out 1065 ms 384 KB Time limit exceeded
25 Execution timed out 1075 ms 256 KB Time limit exceeded
26 Execution timed out 1065 ms 256 KB Time limit exceeded
27 Execution timed out 1080 ms 256 KB Time limit exceeded
28 Execution timed out 1075 ms 256 KB Time limit exceeded
29 Execution timed out 1067 ms 256 KB Time limit exceeded
30 Execution timed out 1068 ms 256 KB Time limit exceeded
31 Execution timed out 1065 ms 128 KB Time limit exceeded
32 Execution timed out 1082 ms 384 KB Time limit exceeded
33 Execution timed out 1081 ms 384 KB Time limit exceeded
34 Execution timed out 1085 ms 256 KB Time limit exceeded
35 Execution timed out 1074 ms 256 KB Time limit exceeded
36 Execution timed out 1079 ms 256 KB Time limit exceeded
37 Execution timed out 1077 ms 384 KB Time limit exceeded
38 Execution timed out 1078 ms 384 KB Time limit exceeded
39 Execution timed out 1084 ms 384 KB Time limit exceeded
40 Execution timed out 1083 ms 256 KB Time limit exceeded
41 Execution timed out 1073 ms 384 KB Time limit exceeded
42 Execution timed out 1077 ms 384 KB Time limit exceeded
43 Execution timed out 1076 ms 384 KB Time limit exceeded
44 Execution timed out 1086 ms 256 KB Time limit exceeded
45 Execution timed out 1082 ms 256 KB Time limit exceeded