이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <stdio.h>
using namespace std;
int main()
{
long long n,three,five,eight,i,k,input;
scanf("%lld",&n);
for(k=1;k<=n;k++)
{
scanf("%lld",&input);
if(!((input-1)*(input-2)*(input-4)*(input-7))) {printf("-1\n"); continue;}
three=0,five=0,eight=0;
if(input>120) {eight+=input/8-15; input %= 120;}
if(input%3==0) three+=input/3;
else if(input%3==1) {five+=2; three+=(input-10)/3;}
else {five+=1; three+=(input-5)/3;}
while(three>=5)
{
three-=5;
five+=3;
}
while(five>=8)
{
five-=8;
eight+=5;
}
while(three && five)
{
three--;
five--;
eight++;
}
for(i=1;i<=three;i++) printf("3");
for(i=1;i<=five;i++) printf("5");
for(i=1;i<=eight;i++) printf("8");
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... |