답안 #121647

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

using namespace std;

typedef unsigned 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 = 2 ; i < t; ++i)
	{
		//cout << v[i] << " \n"[i == t];
		if(v[i-1] == v[i+1]) r = 1;
		else 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 256 KB Output isn't correct
2 Incorrect 2 ms 256 KB Output isn't correct
3 Correct 12 ms 256 KB Output is correct
4 Incorrect 4 ms 256 KB Output isn't correct
5 Correct 2 ms 256 KB Output is correct
6 Incorrect 2 ms 384 KB Output isn't correct
7 Incorrect 2 ms 256 KB Output isn't correct
8 Incorrect 2 ms 384 KB Output isn't correct
9 Incorrect 2 ms 384 KB Output isn't correct
10 Correct 2 ms 256 KB Output is correct
11 Correct 2 ms 256 KB Output is correct
12 Correct 2 ms 256 KB Output is correct
13 Correct 2 ms 256 KB Output is correct
14 Incorrect 4 ms 384 KB Output isn't correct
15 Incorrect 4 ms 384 KB Output isn't correct
16 Correct 2 ms 384 KB Output is correct
17 Correct 4 ms 384 KB Output is correct
18 Correct 2 ms 384 KB Output is correct
19 Correct 12 ms 256 KB Output is correct
20 Incorrect 4 ms 256 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Correct 323 ms 384 KB Output is correct
2 Execution timed out 1072 ms 384 KB Time limit exceeded
3 Execution timed out 1062 ms 384 KB Time limit exceeded
4 Execution timed out 1086 ms 384 KB Time limit exceeded
5 Execution timed out 1078 ms 384 KB Time limit exceeded
6 Execution timed out 1076 ms 384 KB Time limit exceeded
7 Correct 111 ms 384 KB Output is correct
8 Correct 77 ms 384 KB Output is correct
9 Correct 140 ms 384 KB Output is correct
10 Correct 194 ms 384 KB Output is correct
11 Correct 329 ms 396 KB Output is correct
12 Execution timed out 1073 ms 256 KB Time limit exceeded
13 Correct 306 ms 256 KB Output is correct
14 Execution timed out 1078 ms 384 KB Time limit exceeded
15 Execution timed out 1070 ms 384 KB Time limit exceeded
16 Execution timed out 1079 ms 256 KB Time limit exceeded
17 Execution timed out 1080 ms 256 KB Time limit exceeded
18 Execution timed out 1081 ms 256 KB Time limit exceeded
19 Execution timed out 1074 ms 256 KB Time limit exceeded
20 Execution timed out 1080 ms 256 KB Time limit exceeded
21 Execution timed out 1077 ms 252 KB Time limit exceeded
22 Execution timed out 1086 ms 256 KB Time limit exceeded
23 Execution timed out 1073 ms 256 KB Time limit exceeded
24 Execution timed out 1082 ms 384 KB Time limit exceeded
25 Execution timed out 1089 ms 384 KB Time limit exceeded
26 Execution timed out 1081 ms 384 KB Time limit exceeded
27 Execution timed out 1071 ms 384 KB Time limit exceeded
28 Execution timed out 1083 ms 256 KB Time limit exceeded
29 Execution timed out 1091 ms 384 KB Time limit exceeded
30 Execution timed out 1077 ms 384 KB Time limit exceeded
31 Execution timed out 1073 ms 384 KB Time limit exceeded
32 Execution timed out 1087 ms 256 KB Time limit exceeded
33 Execution timed out 1080 ms 256 KB Time limit exceeded
34 Execution timed out 1078 ms 384 KB Time limit exceeded
35 Execution timed out 1089 ms 384 KB Time limit exceeded
36 Execution timed out 1073 ms 256 KB Time limit exceeded
37 Execution timed out 1075 ms 256 KB Time limit exceeded
38 Execution timed out 1085 ms 256 KB Time limit exceeded
39 Execution timed out 1080 ms 256 KB Time limit exceeded
40 Execution timed out 1082 ms 256 KB Time limit exceeded
41 Execution timed out 1078 ms 384 KB Time limit exceeded
42 Execution timed out 1081 ms 256 KB Time limit exceeded
43 Execution timed out 1084 ms 256 KB Time limit exceeded
44 Execution timed out 1086 ms 256 KB Time limit exceeded
45 Execution timed out 1068 ms 384 KB Time limit exceeded