11112 | 2024-07-07 09:40:48 | proba | Számjegycsere | python3 | Accepted 100/100 | 351ms | 10948 KiB |
# 50, 00, 25, 75
lista = [input() for i in range(int(input()))]
#lista = [157, 1001, 152, 7500, 7005, 200253, 52, 22, 10011, 55, 505]#
for i in lista:
# osztható 25-tel
s = str(i)
if '00' in s[-2:] or '25' in s[-2:] or '50' in s[-2:] or '75' in s[-2:]:
print(0)
else:
m1 = 0
# van benne 5-ös továbbá 2 vagy 7-es
if '5' in s and ('2' in s or '7' in s):
if s[-1]=='5' or s[-2:]=='57' or s[-2:]=='52' or s[-2]=='7' or s[-2]=='2':
m1 = 1
else:
m1 = 2
# van benne 5-ös és 0
if '0' in s and '5' in s:
if s[-2:] == '05' or s[-1]=='0' or s[-2]=='5':
m1 = 1
else:
if m1 == 0:
m1 = 2
# ha van benne 2 nulla
if s.count('0')>1:
if s[-1]=='0' or s[-2]=='0':
m1 = 1
else:
if m1 == 0:
m1 = 2
if m1 == 0:
print(-1)
else:
print(m1)
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 17ms | 3044 KiB | ||||
subtask2 | 21/21 | ||||||
2 | Accepted | 127ms | 5964 KiB | ||||
subtask3 | 23/23 | ||||||
3 | Accepted | 300ms | 10688 KiB | ||||
4 | Accepted | 300ms | 10760 KiB | ||||
5 | Accepted | 317ms | 10736 KiB | ||||
6 | Accepted | 305ms | 10740 KiB | ||||
7 | Accepted | 307ms | 10820 KiB | ||||
8 | Accepted | 351ms | 10692 KiB | ||||
9 | Accepted | 307ms | 10820 KiB | ||||
10 | Accepted | 310ms | 10756 KiB | ||||
11 | Accepted | 307ms | 10756 KiB | ||||
12 | Accepted | 303ms | 10820 KiB | ||||
13 | Accepted | 324ms | 10692 KiB | ||||
14 | Accepted | 312ms | 10948 KiB | ||||
15 | Accepted | 312ms | 10784 KiB | ||||
16 | Accepted | 345ms | 10692 KiB | ||||
17 | Accepted | 319ms | 10820 KiB | ||||
18 | Accepted | 324ms | 10820 KiB | ||||
19 | Accepted | 330ms | 10780 KiB | ||||
20 | Accepted | 331ms | 10732 KiB | ||||
21 | Accepted | 307ms | 10844 KiB | ||||
22 | Accepted | 305ms | 10812 KiB | ||||
23 | Accepted | 305ms | 10760 KiB | ||||
subtask4 | 41/41 | ||||||
24 | Accepted | 17ms | 3044 KiB | ||||
25 | Accepted | 17ms | 3192 KiB | ||||
26 | Accepted | 18ms | 3304 KiB | ||||
27 | Accepted | 17ms | 3044 KiB | ||||
28 | Accepted | 18ms | 3192 KiB | ||||
29 | Accepted | 17ms | 3064 KiB | ||||
30 | Accepted | 17ms | 3192 KiB | ||||
31 | Accepted | 17ms | 3172 KiB | ||||
32 | Accepted | 17ms | 2972 KiB | ||||
33 | Accepted | 17ms | 2984 KiB | ||||
34 | Accepted | 17ms | 3064 KiB | ||||
35 | Accepted | 17ms | 3192 KiB | ||||
36 | Accepted | 20ms | 3320 KiB | ||||
37 | Accepted | 43ms | 3348 KiB | ||||
38 | Accepted | 17ms | 3064 KiB | ||||
39 | Accepted | 17ms | 3068 KiB | ||||
40 | Accepted | 17ms | 3064 KiB | ||||
41 | Accepted | 17ms | 2992 KiB | ||||
42 | Accepted | 20ms | 3204 KiB | ||||
43 | Accepted | 20ms | 3216 KiB | ||||
44 | Accepted | 19ms | 3172 KiB | ||||
45 | Accepted | 20ms | 3140 KiB | ||||
46 | Accepted | 18ms | 3064 KiB | ||||
47 | Accepted | 20ms | 3192 KiB | ||||
subtask5 | 15/15 | ||||||
48 | Accepted | 26ms | 4196 KiB | ||||
49 | Accepted | 21ms | 4404 KiB | ||||
50 | Accepted | 347ms | 10592 KiB | ||||
51 | Accepted | 24ms | 4140 KiB | ||||
52 | Accepted | 97ms | 5680 KiB | ||||
53 | Accepted | 21ms | 4208 KiB | ||||
54 | Accepted | 23ms | 4324 KiB | ||||
55 | Accepted | 48ms | 4964 KiB | ||||
56 | Accepted | 280ms | 10696 KiB | ||||
57 | Accepted | 19ms | 4472 KiB | ||||
58 | Accepted | 20ms | 4324 KiB | ||||
59 | Accepted | 19ms | 4344 KiB | ||||
60 | Accepted | 24ms | 4340 KiB | ||||
61 | Accepted | 23ms | 4196 KiB | ||||
62 | Accepted | 24ms | 4344 KiB | ||||
63 | Accepted | 24ms | 4264 KiB | ||||
64 | Accepted | 277ms | 10696 KiB | ||||
65 | Accepted | 282ms | 10824 KiB | ||||
66 | Accepted | 291ms | 10696 KiB |