#include<stdio.h>
int d[100000];
int main()
{
int n,j,q,w,e,a,aa,ew=9999999,cnt,i;
scanf("%d",&n);
for(j=1; j<=n; j++){
scanf("%d",&a); ew=99999999;
for(q=0; q<=a/3; q++){
for(w=0; w<=a/5; w++){
for(e=0; e<=a/8; e++){
// printf("%d %d %d\n",q,w,e);
if(3*q+5*w+8*e==a){
if(ew>q+w+e){
ew=q+w+e;
cnt=0;
for(aa=1; aa<=q; aa++){ cnt++; d[cnt]=3; }
for(aa=1; aa<=w; aa++){ cnt++; d[cnt]=5; }
for(aa=1; aa<=e; aa++){ cnt++; d[cnt]=8; }
}
//q=a/3; w=a/5; e=a/8;
}
}
}
}
for(i=1; i<=cnt; i++) printf("%d",d[i]);
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
1276 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
1276 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
195 ms |
1276 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1000 ms |
0 KB |
Program timed out |
2 |
Halted |
0 ms |
0 KB |
- |