제출 #2426

#제출 시각아이디문제언어결과실행 시간메모리
2426hana5505생일수 I (GA4_birthday1)C++98
0 / 100
1000 ms16512 KiB
#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); for(j=1;j<=n;j++){ cnt[j][0]=cnt[j][1]=cnt[j][2]=0; d[j]=0; } 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",coin[j]); } } printf("\n"); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...