12042 | 2024-11-26 12:25:05 | LordCasinoII | Számjegycsere | python3 | Runtime error 21/100 | 379ms | 10912 KiB |
t = int(input())
k = []
for _ in range(t):
k.append(input())
for _ in range(t):
n = k[_]
if n[-2:] in ['00','25','50','75']:
print(0)
elif n[-1] == '0' and (n[:-1].count('0') >= 1 or n[:-1].count('5') >= 1):
print(1)
elif n[-1] == '5' and (n[:-1].count('2') >= 1 or n[:-1].count('7') >= 1):
print(1)
elif (n[-2] == '2' and n.count('5') >= 1) or (n[-2] == '0' and n.count('0') >= 2) or (n[-2] == '5' and n.count('0')>=1) or (n[-2] == '7' and n.count('5') >= 1):
print(1)
elif n[-2:] in ['52','57','05']:
print(1)
elif (n.count('0') >= 2) or (n.count('5') >= 1 and n.count('0') >= 1) or (n.count('2') >= 1 and n.count('5') >= 1) or (n.count('7') >= 1 and n.count('5') >= 1) or (n.count('5')>=1 and n.count('7') >=1):
print(2)
else:
print(-1)
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 16ms | 3128 KiB | ||||
subtask2 | 21/21 | ||||||
2 | Accepted | 109ms | 5828 KiB | ||||
subtask3 | 0/23 | ||||||
3 | Runtime error | 347ms | 10688 KiB | ||||
4 | Accepted | 349ms | 10696 KiB | ||||
5 | Accepted | 337ms | 10716 KiB | ||||
6 | Accepted | 345ms | 10692 KiB | ||||
7 | Accepted | 351ms | 10696 KiB | ||||
8 | Accepted | 333ms | 10856 KiB | ||||
9 | Accepted | 344ms | 10696 KiB | ||||
10 | Accepted | 342ms | 10828 KiB | ||||
11 | Accepted | 342ms | 10692 KiB | ||||
12 | Accepted | 345ms | 10692 KiB | ||||
13 | Accepted | 307ms | 10848 KiB | ||||
14 | Accepted | 338ms | 10912 KiB | ||||
15 | Accepted | 344ms | 10696 KiB | ||||
16 | Accepted | 314ms | 10696 KiB | ||||
17 | Accepted | 340ms | 10696 KiB | ||||
18 | Accepted | 340ms | 10700 KiB | ||||
19 | Accepted | 305ms | 10700 KiB | ||||
20 | Accepted | 305ms | 10852 KiB | ||||
21 | Accepted | 361ms | 10884 KiB | ||||
22 | Accepted | 351ms | 10696 KiB | ||||
23 | Accepted | 344ms | 10700 KiB | ||||
subtask4 | 0/41 | ||||||
24 | Accepted | 16ms | 3128 KiB | ||||
25 | Accepted | 17ms | 3128 KiB | ||||
26 | Accepted | 17ms | 3128 KiB | ||||
27 | Accepted | 16ms | 3128 KiB | ||||
28 | Accepted | 16ms | 2996 KiB | ||||
29 | Accepted | 14ms | 3188 KiB | ||||
30 | Accepted | 17ms | 3064 KiB | ||||
31 | Accepted | 16ms | 3000 KiB | ||||
32 | Accepted | 16ms | 3128 KiB | ||||
33 | Accepted | 16ms | 3344 KiB | ||||
34 | Accepted | 16ms | 3128 KiB | ||||
35 | Accepted | 17ms | 3128 KiB | ||||
36 | Accepted | 19ms | 3344 KiB | ||||
37 | Runtime error | 26ms | 3292 KiB | ||||
38 | Accepted | 17ms | 3100 KiB | ||||
39 | Accepted | 17ms | 3236 KiB | ||||
40 | Accepted | 16ms | 3128 KiB | ||||
41 | Accepted | 16ms | 3144 KiB | ||||
42 | Accepted | 19ms | 3172 KiB | ||||
43 | Accepted | 19ms | 3224 KiB | ||||
44 | Accepted | 19ms | 3376 KiB | ||||
45 | Accepted | 18ms | 3252 KiB | ||||
46 | Accepted | 16ms | 3132 KiB | ||||
47 | Accepted | 18ms | 3368 KiB | ||||
subtask5 | 0/15 | ||||||
48 | Accepted | 24ms | 4400 KiB | ||||
49 | Accepted | 20ms | 4400 KiB | ||||
50 | Accepted | 321ms | 10712 KiB | ||||
51 | Accepted | 20ms | 4244 KiB | ||||
52 | Runtime error | 39ms | 5284 KiB | ||||
53 | Accepted | 20ms | 4160 KiB | ||||
54 | Accepted | 26ms | 4376 KiB | ||||
55 | Accepted | 59ms | 5020 KiB | ||||
56 | Accepted | 372ms | 10676 KiB | ||||
57 | Accepted | 17ms | 4408 KiB | ||||
58 | Accepted | 18ms | 4364 KiB | ||||
59 | Accepted | 24ms | 4408 KiB | ||||
60 | Accepted | 23ms | 4408 KiB | ||||
61 | Accepted | 23ms | 4408 KiB | ||||
62 | Accepted | 30ms | 4408 KiB | ||||
63 | Accepted | 25ms | 4248 KiB | ||||
64 | Accepted | 379ms | 10704 KiB | ||||
65 | Accepted | 349ms | 10700 KiB | ||||
66 | Accepted | 352ms | 10704 KiB |