답안 #2238

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
2238 2013-07-20T14:51:13 Z kriii 생일수 I (GA4_birthday1) C++
100 / 100
84 ms 912 KB
#include <stdio.h>
#include <queue>

std::queue<int> Q;
long long V[60];

int main()
{
	int i,x,p;

	for (i=0;i<60;i++) V[i] = -1;
	Q.push(0); V[0] = 0;
	while (!Q.empty()){
		x = Q.front(); Q.pop();
		if (x > 50) break;
		if (V[x+3] == -1){
			Q.push(x+3); V[x+3] = V[x] * 10 + 3;
		}
		if (V[x+5] == -1){
			Q.push(x+5); V[x+5] = V[x] * 10 + 5;
		}
		if (V[x+8] == -1){
			Q.push(x+8); V[x+8] = V[x] * 10 + 8;
		}
	}

	int T;

	scanf ("%d",&T); while (T--){
		scanf ("%d",&x);
		if (x <= 50) printf ("%lld",V[x]);
		else{
			p = (x - 50 + 7) / 8;
			x -= p * 8;
			printf ("%lld",V[x]);
			for (i=0;i<p;i++) printf ("8");
		}
		printf ("\n");
	}

	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 912 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 912 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 912 KB Output is correct
2 Correct 0 ms 912 KB Output is correct
3 Correct 0 ms 912 KB Output is correct
4 Correct 0 ms 912 KB Output is correct
5 Correct 0 ms 912 KB Output is correct
6 Correct 0 ms 912 KB Output is correct
7 Correct 0 ms 912 KB Output is correct
8 Correct 0 ms 912 KB Output is correct
9 Correct 0 ms 912 KB Output is correct
10 Correct 0 ms 912 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 71 ms 912 KB Output is correct
2 Correct 64 ms 912 KB Output is correct
3 Correct 72 ms 912 KB Output is correct
4 Correct 61 ms 912 KB Output is correct
5 Correct 72 ms 912 KB Output is correct
6 Correct 60 ms 912 KB Output is correct
7 Correct 66 ms 912 KB Output is correct
8 Correct 75 ms 912 KB Output is correct
9 Correct 56 ms 912 KB Output is correct
10 Correct 65 ms 912 KB Output is correct
11 Correct 66 ms 912 KB Output is correct
12 Correct 65 ms 912 KB Output is correct
13 Correct 79 ms 912 KB Output is correct
14 Correct 84 ms 912 KB Output is correct
15 Correct 68 ms 912 KB Output is correct
16 Correct 65 ms 912 KB Output is correct
17 Correct 64 ms 912 KB Output is correct
18 Correct 71 ms 912 KB Output is correct
19 Correct 76 ms 912 KB Output is correct
20 Correct 65 ms 912 KB Output is correct
21 Correct 76 ms 912 KB Output is correct
22 Correct 71 ms 912 KB Output is correct
23 Correct 65 ms 912 KB Output is correct
24 Correct 72 ms 912 KB Output is correct
25 Correct 70 ms 912 KB Output is correct