11098 | 2024-07-06 23:00:03 | proba | Számjegycsere | python3 | Runtime error 0/100 | 18ms | 3320 KiB |
# 50, 00, 25, 75
lista = [int(input()) for i in range(int(input()))]
#lista = [157, 1001, 152, 7500, 7005, 2253, 52, 22, 10011, 55, 505]
for i in lista:
# osztható 25-tel
if i % 25 == 0:
print(0)
else:
s = str(i)
m1, m2, m3 = 0, 0, 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[-1] == '5' and s[-2]=='0') or s[-1]=='0' or s[-2]='5':
m2 = 1
else:
m2 = 2
# ha van benne 2 nulla
if s.count('0')>1:
if s[-1]=='0' or s[-2]=='0':
m3 = 1
else:
m3 = 2
if m1+m2+m3 == 0:
print(-1)
else:
x = [m1, m2, m3]
while 0 in x:
x.remove(0)
print(min(x))
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Runtime error | 17ms | 3044 KiB | ||||
subtask2 | 0/21 | ||||||
2 | Runtime error | 17ms | 3044 KiB | ||||
subtask3 | 0/23 | ||||||
3 | Runtime error | 17ms | 3044 KiB | ||||
4 | Runtime error | 17ms | 3068 KiB | ||||
5 | Runtime error | 17ms | 3064 KiB | ||||
6 | Runtime error | 17ms | 2844 KiB | ||||
7 | Runtime error | 17ms | 3044 KiB | ||||
8 | Runtime error | 17ms | 3044 KiB | ||||
9 | Runtime error | 17ms | 2952 KiB | ||||
10 | Runtime error | 17ms | 3056 KiB | ||||
11 | Runtime error | 17ms | 3044 KiB | ||||
12 | Runtime error | 17ms | 2972 KiB | ||||
13 | Runtime error | 17ms | 3044 KiB | ||||
14 | Runtime error | 17ms | 3192 KiB | ||||
15 | Runtime error | 17ms | 3044 KiB | ||||
16 | Runtime error | 17ms | 3048 KiB | ||||
17 | Runtime error | 17ms | 3044 KiB | ||||
18 | Runtime error | 17ms | 3192 KiB | ||||
19 | Runtime error | 17ms | 2972 KiB | ||||
20 | Runtime error | 17ms | 2888 KiB | ||||
21 | Runtime error | 17ms | 2944 KiB | ||||
22 | Runtime error | 17ms | 3172 KiB | ||||
23 | Runtime error | 17ms | 2936 KiB | ||||
subtask4 | 0/41 | ||||||
24 | Runtime error | 18ms | 3044 KiB | ||||
25 | Runtime error | 17ms | 2988 KiB | ||||
26 | Runtime error | 18ms | 2900 KiB | ||||
27 | Runtime error | 17ms | 3088 KiB | ||||
28 | Runtime error | 17ms | 3088 KiB | ||||
29 | Runtime error | 17ms | 3044 KiB | ||||
30 | Runtime error | 17ms | 2880 KiB | ||||
31 | Runtime error | 17ms | 3048 KiB | ||||
32 | Runtime error | 17ms | 2904 KiB | ||||
33 | Runtime error | 17ms | 2976 KiB | ||||
34 | Runtime error | 17ms | 3088 KiB | ||||
35 | Runtime error | 17ms | 3172 KiB | ||||
36 | Runtime error | 17ms | 2860 KiB | ||||
37 | Runtime error | 17ms | 2944 KiB | ||||
38 | Runtime error | 17ms | 3228 KiB | ||||
39 | Runtime error | 17ms | 3064 KiB | ||||
40 | Runtime error | 18ms | 2960 KiB | ||||
41 | Runtime error | 17ms | 3044 KiB | ||||
42 | Runtime error | 17ms | 3040 KiB | ||||
43 | Runtime error | 17ms | 3172 KiB | ||||
44 | Runtime error | 18ms | 2916 KiB | ||||
45 | Runtime error | 17ms | 2916 KiB | ||||
46 | Runtime error | 17ms | 3228 KiB | ||||
47 | Runtime error | 17ms | 3044 KiB | ||||
subtask5 | 0/15 | ||||||
48 | Runtime error | 18ms | 2896 KiB | ||||
49 | Runtime error | 17ms | 3080 KiB | ||||
50 | Runtime error | 18ms | 2916 KiB | ||||
51 | Runtime error | 17ms | 2952 KiB | ||||
52 | Runtime error | 17ms | 2992 KiB | ||||
53 | Runtime error | 17ms | 3044 KiB | ||||
54 | Runtime error | 17ms | 3088 KiB | ||||
55 | Runtime error | 17ms | 3184 KiB | ||||
56 | Runtime error | 18ms | 3320 KiB | ||||
57 | Runtime error | 18ms | 2900 KiB | ||||
58 | Runtime error | 17ms | 3064 KiB | ||||
59 | Runtime error | 17ms | 2928 KiB | ||||
60 | Runtime error | 17ms | 2972 KiB | ||||
61 | Runtime error | 17ms | 2876 KiB | ||||
62 | Runtime error | 17ms | 3064 KiB | ||||
63 | Runtime error | 17ms | 2972 KiB | ||||
64 | Runtime error | 17ms | 2972 KiB | ||||
65 | Runtime error | 17ms | 3044 KiB | ||||
66 | Runtime error | 17ms | 2936 KiB |