#include<iostream>
#include<stdio.h>
#include<list>
#include<fstream>
using namespace std;
int main()
{
// FILE *ifp=freopen("input.txt", "r", stdin);
int t,n,i;
list<int> d;
list<int>::iterator j;
scanf("%d", &t);
for(i=1; i<=t; i++){
scanf("%d", &n);
d.clear();
while(1){
if(n==0) break;
else if((n-8)>=0 && (n-8)%3==0 || (n-5)>=0 && (n-8)%5==0 || (n-5)>=0 && (n-8)%8==0){
d.push_front(8);
n=n-8;
}
else if((n-5)>=0 && (n-5)%3==0 || (n-5)>=0 && (n-5)%5==0 || (n-5)>=0 && (n-5)%8==0){
d.push_front(5);
n=n-5;
}
else if((n-3)>=0 && (n-3)%3==0 || (n-5)>=0 && (n-3)%5==0 || (n-5)>=0 && (n-3)%8==0){
d.push_front(3);
n=n-3;
}
}
for(j=d.begin(); j!=d.end(); ++j) printf("%d ", *j);
printf("\n");
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1000 ms |
0 KB |
Program timed out |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1000 ms |
0 KB |
Program timed out |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1000 ms |
0 KB |
Program timed out |
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 |
- |