12038 | 2024-11-26 12:17:02 | markmaster78 | Számjegycsere | python3 | Accepted 100/100 | 337ms | 10880 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 | 3124 KiB | ||||
subtask2 | 21/21 | ||||||
2 | Accepted | 116ms | 5832 KiB | ||||
subtask3 | 23/23 | ||||||
3 | Accepted | 287ms | 10880 KiB | ||||
4 | Accepted | 298ms | 10872 KiB | ||||
5 | Accepted | 291ms | 10748 KiB | ||||
6 | Accepted | 287ms | 10740 KiB | ||||
7 | Accepted | 291ms | 10772 KiB | ||||
8 | Accepted | 321ms | 10784 KiB | ||||
9 | Accepted | 289ms | 10876 KiB | ||||
10 | Accepted | 296ms | 10756 KiB | ||||
11 | Accepted | 289ms | 10696 KiB | ||||
12 | Accepted | 296ms | 10696 KiB | ||||
13 | Accepted | 305ms | 10764 KiB | ||||
14 | Accepted | 296ms | 10696 KiB | ||||
15 | Accepted | 287ms | 10696 KiB | ||||
16 | Accepted | 321ms | 10788 KiB | ||||
17 | Accepted | 289ms | 10804 KiB | ||||
18 | Accepted | 293ms | 10768 KiB | ||||
19 | Accepted | 316ms | 10664 KiB | ||||
20 | Accepted | 314ms | 10664 KiB | ||||
21 | Accepted | 293ms | 10660 KiB | ||||
22 | Accepted | 298ms | 10660 KiB | ||||
23 | Accepted | 289ms | 10664 KiB | ||||
subtask4 | 41/41 | ||||||
24 | Accepted | 16ms | 3312 KiB | ||||
25 | Accepted | 16ms | 2996 KiB | ||||
26 | Accepted | 16ms | 3140 KiB | ||||
27 | Accepted | 14ms | 3184 KiB | ||||
28 | Accepted | 17ms | 3320 KiB | ||||
29 | Accepted | 14ms | 3144 KiB | ||||
30 | Accepted | 16ms | 2980 KiB | ||||
31 | Accepted | 16ms | 3128 KiB | ||||
32 | Accepted | 14ms | 3224 KiB | ||||
33 | Accepted | 14ms | 3116 KiB | ||||
34 | Accepted | 14ms | 3128 KiB | ||||
35 | Accepted | 17ms | 3236 KiB | ||||
36 | Accepted | 17ms | 3356 KiB | ||||
37 | Accepted | 37ms | 3440 KiB | ||||
38 | Accepted | 16ms | 3224 KiB | ||||
39 | Accepted | 17ms | 3196 KiB | ||||
40 | Accepted | 16ms | 3128 KiB | ||||
41 | Accepted | 16ms | 3132 KiB | ||||
42 | Accepted | 17ms | 3308 KiB | ||||
43 | Accepted | 18ms | 3256 KiB | ||||
44 | Accepted | 17ms | 3128 KiB | ||||
45 | Accepted | 18ms | 3304 KiB | ||||
46 | Accepted | 16ms | 3168 KiB | ||||
47 | Accepted | 19ms | 3144 KiB | ||||
subtask5 | 15/15 | ||||||
48 | Accepted | 23ms | 4260 KiB | ||||
49 | Accepted | 20ms | 4288 KiB | ||||
50 | Accepted | 337ms | 10748 KiB | ||||
51 | Accepted | 20ms | 4112 KiB | ||||
52 | Accepted | 90ms | 5688 KiB | ||||
53 | Accepted | 18ms | 4036 KiB | ||||
54 | Accepted | 20ms | 4164 KiB | ||||
55 | Accepted | 45ms | 5080 KiB | ||||
56 | Accepted | 272ms | 10688 KiB | ||||
57 | Accepted | 17ms | 4212 KiB | ||||
58 | Accepted | 18ms | 4352 KiB | ||||
59 | Accepted | 18ms | 4276 KiB | ||||
60 | Accepted | 21ms | 4288 KiB | ||||
61 | Accepted | 20ms | 4300 KiB | ||||
62 | Accepted | 20ms | 4292 KiB | ||||
63 | Accepted | 21ms | 4152 KiB | ||||
64 | Accepted | 273ms | 10820 KiB | ||||
65 | Accepted | 270ms | 10688 KiB | ||||
66 | Accepted | 268ms | 10692 KiB |