9703 | 2024-03-02 13:07:30 | szelland | Kiváló Számok | python3 | Accepted 100/100 | 930ms | 47640 KiB |
def sum1(string):
n = 0
for i in string:
n += int(i)
return n
def to_str(inp):
r = ''
for i in inp:
r += i
return r
input = int(input())
num1 = '1' * input
def solve(num) -> str:
if num != '5' * input:
if sum1(num) % 3 == 0:
return num
else:
num = list(num)
num[0] = '5'
num = sorted(num)
num = to_str(num)
return solve(num)
else:
return -1
print(solve(num1))
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 18ms | 11404 KiB | ||||
subtask2 | 33/33 | ||||||
2 | Accepted | 17ms | 11688 KiB | ||||
3 | Accepted | 17ms | 12116 KiB | ||||
4 | Accepted | 17ms | 11928 KiB | ||||
5 | Accepted | 18ms | 12392 KiB | ||||
6 | Accepted | 17ms | 12668 KiB | ||||
7 | Accepted | 17ms | 12480 KiB | ||||
8 | Accepted | 17ms | 12728 KiB | ||||
subtask3 | 33/33 | ||||||
9 | Accepted | 71ms | 13620 KiB | ||||
10 | Accepted | 479ms | 29768 KiB | ||||
11 | Accepted | 150ms | 15192 KiB | ||||
12 | Accepted | 301ms | 28944 KiB | ||||
13 | Accepted | 310ms | 29428 KiB | ||||
14 | Accepted | 177ms | 22276 KiB | ||||
15 | Accepted | 126ms | 17184 KiB | ||||
16 | Accepted | 68ms | 14416 KiB | ||||
17 | Accepted | 101ms | 15364 KiB | ||||
18 | Accepted | 337ms | 32244 KiB | ||||
19 | Accepted | 129ms | 20452 KiB | ||||
20 | Accepted | 435ms | 37704 KiB | ||||
subtask4 | 34/34 | ||||||
21 | Accepted | 930ms | 47640 KiB | ||||
22 | Accepted | 187ms | 20496 KiB | ||||
23 | Accepted | 584ms | 46044 KiB | ||||
24 | Accepted | 237ms | 18340 KiB | ||||
25 | Accepted | 186ms | 17664 KiB | ||||
26 | Accepted | 104ms | 16264 KiB | ||||
27 | Accepted | 778ms | 42428 KiB | ||||
28 | Accepted | 671ms | 38924 KiB | ||||
29 | Accepted | 89ms | 18872 KiB | ||||
30 | Accepted | 358ms | 33860 KiB | ||||
31 | Accepted | 375ms | 33452 KiB | ||||
32 | Accepted | 26ms | 15224 KiB | ||||
33 | Accepted | 35ms | 15128 KiB |