# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
2389 |
2013-07-21T05:10:03 Z |
hgp744 |
생일수 II (GA4_birthday2) |
C++ |
|
0 ms |
880 KB |
#include<stdio.h>
int main()
{
int n, i, t, j, a, b, c, k, l;
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
scanf("%d", &n);
for(i=1;i<=n;i++){
scanf("%d", &t);
a = b = c = 0;
for(j=t/8;j>=0;j--){
for(k=(t-(j*8))/5;k>=0;k--){
if(j+k+((t-(j*8)-(k*5))/3)>a+b+c && (a!=0 || b!=0 || c!=0)) break;
if((t-(j*8)-(k*5))%3==0){
if(j+k+((t-(j*8)-(k*5))/3)<a+b+c || (a==0 && b==0 && c==0)){
a = j;
b = k;
c = (t-(j*8)-(k*5))/3;
}
else if(j+k+((t-(j*8)-(k*5))/3)==a+b+c){
if(a<j){
a = j;
b = k;
c = (t-(j*8)-(k*5))/3;
}
else if(a==j){
if(b<k){
a = j;
b = k;
c = (t-(j*8)-(k*5))/3;
}
}
}
}
}
}
if(a==0 && b==0 && c==0) printf("-1\n");
else{
for(j=1;j<=c;j++) printf("3");
for(j=1;j<=b;j++) printf("5");
for(j=1;j<=a;j++) printf("8");
printf("\n");
}
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
0 ms |
880 KB |
close (syscall #3) was called by the program (disallowed syscall) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
0 ms |
880 KB |
close (syscall #3) was called by the program (disallowed syscall) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
0 ms |
880 KB |
close (syscall #3) was called by the program (disallowed syscall) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
0 ms |
880 KB |
close (syscall #3) was called by the program (disallowed syscall) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
0 ms |
880 KB |
close (syscall #3) was called by the program (disallowed syscall) |
2 |
Halted |
0 ms |
0 KB |
- |