답안 #2166

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
2166 2013-07-20T06:37:37 Z jwvg0425 생일수 I (GA4_birthday1) C++
41 / 100
683 ms 12604 KB
#include<stdio.h>
int t,n;
int table[1000001],trace[1000001],number[1000001];
int min(int a,int b){return a<b?a:b;}
int main()
{
	int i,m,k=8,j,a;

	scanf("%d",&t);
	trace[3]=trace[6]=3;
	trace[5]=5;
	trace[8]=8;
	table[3]=table[5]=table[8]=1;
	table[6]=2;
	table[1]=table[2]=table[4]=table[7]=100;
	for(a=0;a<t;a++)
	{
		scanf("%d",&n);
		if(n>k)
		{
			for(i=k+1;i<=n;i++)
			{
				m=min(table[i-3],table[i-5]);
				m=min(m,table[i-8]);
				table[i]=m+1;
				if(m==table[i-3])trace[i]=3;
				if(m==table[i-5])trace[i]=5;
				if(m==table[i-8])trace[i]=8;
			}
			k=n;
		}
		j=0;
		for(i=n;i>0;)
		{
			number[j++]=trace[i];
			i-=trace[i];
		}
		for(j--;j>=0;j--)printf("%d",number[j]);
		printf("\n");
	}
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 12604 KB SIGSEGV Segmentation fault
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 12604 KB SIGSEGV Segmentation fault
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 12604 KB Output is correct
2 Runtime error 4 ms 12604 KB SIGSEGV Segmentation fault
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 608 ms 12604 KB Output is correct
2 Correct 601 ms 12604 KB Output is correct
3 Correct 650 ms 12604 KB Output is correct
4 Correct 574 ms 12604 KB Output is correct
5 Correct 619 ms 12604 KB Output is correct
6 Correct 612 ms 12604 KB Output is correct
7 Correct 641 ms 12604 KB Output is correct
8 Correct 649 ms 12604 KB Output is correct
9 Correct 649 ms 12604 KB Output is correct
10 Correct 628 ms 12604 KB Output is correct
11 Correct 600 ms 12604 KB Output is correct
12 Correct 613 ms 12604 KB Output is correct
13 Correct 661 ms 12604 KB Output is correct
14 Correct 683 ms 12604 KB Output is correct
15 Correct 612 ms 12604 KB Output is correct
16 Correct 620 ms 12604 KB Output is correct
17 Correct 597 ms 12604 KB Output is correct
18 Correct 604 ms 12604 KB Output is correct
19 Correct 681 ms 12604 KB Output is correct
20 Correct 610 ms 12604 KB Output is correct
21 Correct 613 ms 12604 KB Output is correct
22 Correct 600 ms 12604 KB Output is correct
23 Correct 593 ms 12604 KB Output is correct
24 Correct 594 ms 12604 KB Output is correct
25 Correct 592 ms 12604 KB Output is correct