# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
2305 |
2013-07-21T02:14:17 Z |
6590f1 |
생일수 I (GA4_birthday1) |
C++ |
|
66 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;}
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(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 |
Incorrect |
0 ms |
884 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
884 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
66 ms |
884 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |