# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
2323 |
2013-07-21T02:37:25 Z |
6590f1 |
생일수 I (GA4_birthday1) |
C++ |
|
73 ms |
884 KB |
#include<stdio.h>
int main()
{
int n,a=0,b=0,c=0,k,i,j,t;
scanf("%d",&t);
for(i=1;i<=t;i++){
a=0;b=0;c=0;
scanf("%d",&n);
a=n/3;
k=n%3;
if(k==1){
if(a>=5){a=a-5;c=c+2;k=0;}
else if(a>=3){a=a-3;b=b+2;k=0;}
}
if(k==2){
if(a>=2){c++;a=a-2;k=0;}
else if(a>=1){b++;k=0;a--;}
}
if(a>=8){c=c+(a/8)*3;a=a%8;}
if(a>=5){b=b+(a/5)*3;a=a%5;}
if(b>=8){c=c+(b/8)*5;b=b%8;}
if(a>0 && b>0){
if(a>=b){c=c+b;a=a-b;b=0;}
if(a<b){c=c+a;b=b-a;a=0;}
}
if(a>=4 && c>=1){
a=a-4;
c--;
b=b+4;
}
if(k==0){
for(j=1;j<=a;j++)printf("3");
for(j=1;j<=b;j++)printf("5");
for(j=1;j<=c;j++)printf("8");
}
else printf("-1");
printf("\n");
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
884 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
884 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
884 KB |
Output is correct |
2 |
Correct |
0 ms |
884 KB |
Output is correct |
3 |
Correct |
0 ms |
884 KB |
Output is correct |
4 |
Correct |
0 ms |
884 KB |
Output is correct |
5 |
Correct |
0 ms |
884 KB |
Output is correct |
6 |
Correct |
0 ms |
884 KB |
Output is correct |
7 |
Correct |
0 ms |
884 KB |
Output is correct |
8 |
Correct |
0 ms |
884 KB |
Output is correct |
9 |
Correct |
0 ms |
884 KB |
Output is correct |
10 |
Correct |
0 ms |
884 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
61 ms |
884 KB |
Output is correct |
2 |
Correct |
56 ms |
884 KB |
Output is correct |
3 |
Correct |
69 ms |
884 KB |
Output is correct |
4 |
Correct |
64 ms |
884 KB |
Output is correct |
5 |
Correct |
68 ms |
884 KB |
Output is correct |
6 |
Correct |
59 ms |
884 KB |
Output is correct |
7 |
Correct |
64 ms |
884 KB |
Output is correct |
8 |
Correct |
66 ms |
884 KB |
Output is correct |
9 |
Correct |
70 ms |
884 KB |
Output is correct |
10 |
Correct |
70 ms |
884 KB |
Output is correct |
11 |
Correct |
56 ms |
884 KB |
Output is correct |
12 |
Correct |
68 ms |
884 KB |
Output is correct |
13 |
Correct |
70 ms |
884 KB |
Output is correct |
14 |
Correct |
73 ms |
884 KB |
Output is correct |
15 |
Correct |
63 ms |
884 KB |
Output is correct |
16 |
Correct |
71 ms |
884 KB |
Output is correct |
17 |
Correct |
57 ms |
884 KB |
Output is correct |
18 |
Correct |
62 ms |
884 KB |
Output is correct |
19 |
Correct |
66 ms |
884 KB |
Output is correct |
20 |
Correct |
62 ms |
884 KB |
Output is correct |
21 |
Correct |
64 ms |
884 KB |
Output is correct |
22 |
Correct |
69 ms |
884 KB |
Output is correct |
23 |
Correct |
56 ms |
884 KB |
Output is correct |
24 |
Correct |
59 ms |
884 KB |
Output is correct |
25 |
Correct |
66 ms |
884 KB |
Output is correct |