Submission #2300

#TimeUsernameProblemLanguageResultExecution timeMemory
2300richkc2006생일수 I (GA4_birthday1)C++98
14 / 100
723 ms5072 KiB
#include<iostream> #include<stdio.h> #include<list> using namespace std; int main() { 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; } else {printf("-1"); break;} } for(j=d.begin(); j!=d.end(); ++j) printf("%d", *j); printf("\n"); } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...