Submission #2185

#TimeUsernameProblemLanguageResultExecution timeMemory
2185cki86201생일수 I (GA4_birthday1)C++98
14 / 100
0 ms888 KiB
#include<stdio.h> int B[250][3]; //[0]:3,[1]:5,[2]:8 int s[250],N; bool ch[250]; int main() { int i,j,k; for(i=0;i<=80;i++){ for(j=0;3*i+5*j<=240;j++){ for(k=0;3*i+5*j+8*k<=240;k++){ int x=3*i+5*j+8*k; if(!ch[x]){ch[x]=1;s[x]=i+j+k;B[x][0]=i;B[x][1]=j;B[x][2]=k;continue;} if(s[x]>i+j+k || s[x]==i+j+k&&B[x][0]>i){ s[x]=i+j+k;B[x][0]=i;B[x][1]=j;B[x][2]=k; } } } } // for(i=1;i<=240;i++)printf("%d : %d %d %d\n",i,B[i][0],B[i][1],B[i][2]); int t;scanf("%d",&t); while(t--){ scanf("%d",&N); if(N==1 || N==2 || N==4 || N==7){printf("-1\n");continue;} if(N<=240){ for(i=1;i<=B[N][0];i++)printf("3"); for(i=1;i<=B[N][1];i++)printf("5"); for(i=1;i<=B[N][2];i++)printf("8"); printf("\n"); } } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...