Submission #2424

# Submission time Handle Problem Language Result Execution time Memory
2424 2013-07-21T10:18:37 Z hana5505 생일수 I (GA4_birthday1) C++
0 / 100
1000 ms 16512 KB
#include<stdio.h>
int cnt[1000011][3];
int d[1000011];
int coin[3]={3,5,8};
int main()
{
	int i,j,k,t,n;

	scanf("%d",&t);

	for(i=1;i<=t;i++){
		scanf("%d",&n);

		d[3]=1;cnt[3][0]=1;
		d[5]=1;cnt[5][1]=1;
		d[8]=1;cnt[8][2]=1;
		for(j=1;j<=n;j++){
			if(!d[j]) continue;
			for(k=0;k<3;k++){
				if(d[j]+1<d[j+coin[k]] || !d[j+coin[k]]){
					d[j+coin[k]]=d[j]+1;
					cnt[j+coin[k]][0]=cnt[j][0];
					cnt[j+coin[k]][1]=cnt[j][1];
					cnt[j+coin[k]][2]=cnt[j][2];
					cnt[j+coin[k]][k]++;
				}
			}
		}
		for(j=0;j<3;j++){
			if(cnt[n][j]){
				for(k=1;k<=cnt[n][j];k++)
					printf("%d\n",coin[j]);
			}
		}
	}
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 16512 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 16512 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 16512 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1000 ms 16512 KB Program timed out
2 Halted 0 ms 0 KB -