# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
2188 |
2013-07-20T08:41:06 Z |
cki86201 |
생일수 I (GA4_birthday1) |
C++ |
|
91 ms |
888 KB |
#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;
}
}
}
}
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");
continue;
}
int t=N%120+120;
for(i=1;i<=B[t][0];i++)printf("3");
for(i=1;i<=B[t][1];i++)printf("5");
for(i=1;i<=B[t][2]+(N/120)*15-15;i++)printf("8");
printf("\n");
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
888 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
888 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
888 KB |
Output is correct |
2 |
Correct |
0 ms |
888 KB |
Output is correct |
3 |
Correct |
0 ms |
888 KB |
Output is correct |
4 |
Correct |
0 ms |
888 KB |
Output is correct |
5 |
Correct |
0 ms |
888 KB |
Output is correct |
6 |
Correct |
0 ms |
888 KB |
Output is correct |
7 |
Correct |
0 ms |
888 KB |
Output is correct |
8 |
Correct |
0 ms |
888 KB |
Output is correct |
9 |
Correct |
0 ms |
888 KB |
Output is correct |
10 |
Correct |
0 ms |
888 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
70 ms |
888 KB |
Output is correct |
2 |
Correct |
78 ms |
888 KB |
Output is correct |
3 |
Correct |
83 ms |
888 KB |
Output is correct |
4 |
Correct |
67 ms |
888 KB |
Output is correct |
5 |
Correct |
78 ms |
888 KB |
Output is correct |
6 |
Correct |
76 ms |
888 KB |
Output is correct |
7 |
Correct |
86 ms |
888 KB |
Output is correct |
8 |
Correct |
77 ms |
888 KB |
Output is correct |
9 |
Correct |
91 ms |
888 KB |
Output is correct |
10 |
Correct |
74 ms |
888 KB |
Output is correct |
11 |
Correct |
75 ms |
888 KB |
Output is correct |
12 |
Correct |
77 ms |
888 KB |
Output is correct |
13 |
Correct |
75 ms |
888 KB |
Output is correct |
14 |
Correct |
78 ms |
888 KB |
Output is correct |
15 |
Correct |
76 ms |
888 KB |
Output is correct |
16 |
Correct |
76 ms |
888 KB |
Output is correct |
17 |
Correct |
72 ms |
888 KB |
Output is correct |
18 |
Correct |
71 ms |
888 KB |
Output is correct |
19 |
Correct |
85 ms |
888 KB |
Output is correct |
20 |
Correct |
67 ms |
888 KB |
Output is correct |
21 |
Correct |
80 ms |
888 KB |
Output is correct |
22 |
Correct |
74 ms |
888 KB |
Output is correct |
23 |
Correct |
74 ms |
888 KB |
Output is correct |
24 |
Correct |
67 ms |
888 KB |
Output is correct |
25 |
Correct |
68 ms |
888 KB |
Output is correct |