11100 | 2024-07-06 23:05:20 | proba | Számjegycsere | python3 | Runtime error 85/100 | 388ms | 7808 KiB |
# 50, 00, 25, 75
lista = [int(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
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[-2:] == '05' 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 | Accepted | 17ms | 3044 KiB | ||||
subtask2 | 21/21 | ||||||
2 | Accepted | 141ms | 4800 KiB | ||||
subtask3 | 23/23 | ||||||
3 | Accepted | 303ms | 7660 KiB | ||||
4 | Accepted | 312ms | 7684 KiB | ||||
5 | Accepted | 324ms | 7664 KiB | ||||
6 | Accepted | 312ms | 7656 KiB | ||||
7 | Accepted | 308ms | 7640 KiB | ||||
8 | Accepted | 382ms | 7664 KiB | ||||
9 | Accepted | 312ms | 7664 KiB | ||||
10 | Accepted | 331ms | 7584 KiB | ||||
11 | Accepted | 314ms | 7608 KiB | ||||
12 | Accepted | 308ms | 7680 KiB | ||||
13 | Accepted | 345ms | 7700 KiB | ||||
14 | Accepted | 324ms | 7808 KiB | ||||
15 | Accepted | 312ms | 7668 KiB | ||||
16 | Accepted | 388ms | 7624 KiB | ||||
17 | Accepted | 328ms | 7756 KiB | ||||
18 | Accepted | 323ms | 7624 KiB | ||||
19 | Accepted | 363ms | 7624 KiB | ||||
20 | Accepted | 349ms | 7668 KiB | ||||
21 | Accepted | 328ms | 7624 KiB | ||||
22 | Accepted | 319ms | 7624 KiB | ||||
23 | Accepted | 310ms | 7688 KiB | ||||
subtask4 | 41/41 | ||||||
24 | Accepted | 18ms | 3044 KiB | ||||
25 | Accepted | 17ms | 3080 KiB | ||||
26 | Accepted | 18ms | 3044 KiB | ||||
27 | Accepted | 17ms | 3044 KiB | ||||
28 | Accepted | 17ms | 3044 KiB | ||||
29 | Accepted | 17ms | 3188 KiB | ||||
30 | Accepted | 18ms | 3044 KiB | ||||
31 | Accepted | 18ms | 3044 KiB | ||||
32 | Accepted | 17ms | 3048 KiB | ||||
33 | Accepted | 19ms | 3112 KiB | ||||
34 | Accepted | 18ms | 3044 KiB | ||||
35 | Accepted | 17ms | 3044 KiB | ||||
36 | Accepted | 21ms | 3172 KiB | ||||
37 | Accepted | 43ms | 3428 KiB | ||||
38 | Accepted | 18ms | 3116 KiB | ||||
39 | Accepted | 18ms | 3180 KiB | ||||
40 | Accepted | 18ms | 2908 KiB | ||||
41 | Accepted | 18ms | 3044 KiB | ||||
42 | Accepted | 20ms | 3060 KiB | ||||
43 | Accepted | 20ms | 3320 KiB | ||||
44 | Accepted | 19ms | 3172 KiB | ||||
45 | Accepted | 20ms | 3228 KiB | ||||
46 | Accepted | 18ms | 3192 KiB | ||||
47 | Accepted | 21ms | 3172 KiB | ||||
subtask5 | 0/15 | ||||||
48 | Accepted | 59ms | 3576 KiB | ||||
49 | Runtime error | 17ms | 3080 KiB | ||||
50 | Accepted | 386ms | 7476 KiB | ||||
51 | Runtime error | 18ms | 3336 KiB | ||||
52 | Accepted | 114ms | 4676 KiB | ||||
53 | Runtime error | 17ms | 3064 KiB | ||||
54 | Accepted | 57ms | 3684 KiB | ||||
55 | Accepted | 56ms | 4344 KiB | ||||
56 | Accepted | 275ms | 7560 KiB | ||||
57 | Runtime error | 17ms | 3300 KiB | ||||
58 | Runtime error | 17ms | 3444 KiB | ||||
59 | Runtime error | 17ms | 3300 KiB | ||||
60 | Accepted | 57ms | 3848 KiB | ||||
61 | Accepted | 57ms | 3556 KiB | ||||
62 | Accepted | 57ms | 3684 KiB | ||||
63 | Accepted | 57ms | 3704 KiB | ||||
64 | Accepted | 270ms | 7632 KiB | ||||
65 | Accepted | 270ms | 7448 KiB | ||||
66 | Accepted | 273ms | 7760 KiB |