이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |