Submission #18857

# Submission time Handle Problem Language Result Execution time Memory
18857 2016-02-16T04:26:26 Z Namnamseo 생일수 I (GA4_birthday1) C++14
100 / 100
101 ms 1084 KB
#include <cstdio>

int tmp[10];

int main()
{
    for(int i=0;i<8;++i){
        tmp[i]=i;
        while(tmp[i]%3 && tmp[i]%5) tmp[i]+=8;
    }
    int t;
    scanf("%d",&t);
for(;t--;){
    int n;
    scanf("%d",&n);
    int a=tmp[n&7];
    if(n<a){
        puts("-1"); continue;
    }
    if(a==12 && n>=20) a=20;
    n-=a;
    if(a%5 == 0) for(;a;a-=5) putchar('5');
    else for(;a;a-=3) putchar('3');
    for(;n;n-=8) putchar('8');
    putchar(10);
}
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1084 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1084 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1084 KB Output is correct
2 Correct 0 ms 1084 KB Output is correct
3 Correct 0 ms 1084 KB Output is correct
4 Correct 0 ms 1084 KB Output is correct
5 Correct 0 ms 1084 KB Output is correct
6 Correct 0 ms 1084 KB Output is correct
7 Correct 0 ms 1084 KB Output is correct
8 Correct 0 ms 1084 KB Output is correct
9 Correct 0 ms 1084 KB Output is correct
10 Correct 0 ms 1084 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 48 ms 1084 KB Output is correct
2 Correct 60 ms 1084 KB Output is correct
3 Correct 0 ms 1084 KB Output is correct
4 Correct 64 ms 1084 KB Output is correct
5 Correct 66 ms 1084 KB Output is correct
6 Correct 57 ms 1084 KB Output is correct
7 Correct 56 ms 1084 KB Output is correct
8 Correct 56 ms 1084 KB Output is correct
9 Correct 64 ms 1084 KB Output is correct
10 Correct 101 ms 1084 KB Output is correct
11 Correct 0 ms 1084 KB Output is correct
12 Correct 0 ms 1084 KB Output is correct
13 Correct 49 ms 1084 KB Output is correct
14 Correct 0 ms 1084 KB Output is correct
15 Correct 61 ms 1084 KB Output is correct
16 Correct 70 ms 1084 KB Output is correct
17 Correct 68 ms 1084 KB Output is correct
18 Correct 0 ms 1084 KB Output is correct
19 Correct 55 ms 1084 KB Output is correct
20 Correct 82 ms 1084 KB Output is correct
21 Correct 0 ms 1084 KB Output is correct
22 Correct 90 ms 1084 KB Output is correct
23 Correct 97 ms 1084 KB Output is correct
24 Correct 72 ms 1084 KB Output is correct
25 Correct 74 ms 1084 KB Output is correct