12126 | 2024-12-03 12:13:09 | pandamaci | Számjegycsere | python3 | Accepted 100/100 | 558ms | 3608 KiB |
N = int(input())
m = -1
for i in range(N):
K = input()
if len(K) >= 2:
if K[-2:] in ['00','25','50','75']:
m = 0
elif K[-2:] in ['52','05','57']:
m = 1
elif K[-1] == '5' and ('2' in K or '7' in K[:-1]):
m = 1
elif K[-1] == '0' and ('5' in K or '0' in K[:-1]):
m = 1
elif K[-2] == '2' and ('5' in K ):
m = 1
elif K[-2] == '5' and ('0' in K ):
m = 1
elif K[-2] == '7' and ('5' in K):
m = 1
elif K[-2] == '0' and K.count('0')>= 2:
m = 1
elif '2' in K and '5' in K:
m = 2
elif '5' in K and '7' in K:
m = 2
elif K.count('0') > 1:
m = 2
elif '5' in K and '0' in K:
m = 2
else:
m = -1
else:
m = -1
print(m)
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 16ms | 2996 KiB | ||||
subtask2 | 21/21 | ||||||
2 | Accepted | 172ms | 3128 KiB | ||||
subtask3 | 23/23 | ||||||
3 | Accepted | 527ms | 3468 KiB | ||||
4 | Accepted | 541ms | 3392 KiB | ||||
5 | Accepted | 513ms | 3280 KiB | ||||
6 | Accepted | 524ms | 3240 KiB | ||||
7 | Accepted | 518ms | 3384 KiB | ||||
8 | Accepted | 508ms | 3308 KiB | ||||
9 | Accepted | 527ms | 3476 KiB | ||||
10 | Accepted | 522ms | 3384 KiB | ||||
11 | Accepted | 528ms | 3468 KiB | ||||
12 | Accepted | 508ms | 3292 KiB | ||||
13 | Accepted | 509ms | 3384 KiB | ||||
14 | Accepted | 519ms | 3384 KiB | ||||
15 | Accepted | 518ms | 3384 KiB | ||||
16 | Accepted | 555ms | 3384 KiB | ||||
17 | Accepted | 523ms | 3324 KiB | ||||
18 | Accepted | 527ms | 3308 KiB | ||||
19 | Accepted | 508ms | 3384 KiB | ||||
20 | Accepted | 558ms | 3464 KiB | ||||
21 | Accepted | 509ms | 3456 KiB | ||||
22 | Accepted | 524ms | 3384 KiB | ||||
23 | Accepted | 501ms | 3388 KiB | ||||
subtask4 | 41/41 | ||||||
24 | Accepted | 16ms | 3128 KiB | ||||
25 | Accepted | 17ms | 3124 KiB | ||||
26 | Accepted | 16ms | 3128 KiB | ||||
27 | Accepted | 17ms | 3128 KiB | ||||
28 | Accepted | 16ms | 3200 KiB | ||||
29 | Accepted | 14ms | 3196 KiB | ||||
30 | Accepted | 16ms | 3040 KiB | ||||
31 | Accepted | 16ms | 3036 KiB | ||||
32 | Accepted | 16ms | 3172 KiB | ||||
33 | Accepted | 16ms | 3080 KiB | ||||
34 | Accepted | 16ms | 3112 KiB | ||||
35 | Accepted | 16ms | 3128 KiB | ||||
36 | Accepted | 21ms | 3320 KiB | ||||
37 | Accepted | 54ms | 3128 KiB | ||||
38 | Accepted | 17ms | 3144 KiB | ||||
39 | Accepted | 16ms | 3128 KiB | ||||
40 | Accepted | 17ms | 3128 KiB | ||||
41 | Accepted | 16ms | 3064 KiB | ||||
42 | Accepted | 20ms | 3200 KiB | ||||
43 | Accepted | 20ms | 3140 KiB | ||||
44 | Accepted | 21ms | 2992 KiB | ||||
45 | Accepted | 20ms | 3152 KiB | ||||
46 | Accepted | 16ms | 3120 KiB | ||||
47 | Accepted | 20ms | 3200 KiB | ||||
subtask5 | 15/15 | ||||||
48 | Accepted | 21ms | 3012 KiB | ||||
49 | Accepted | 17ms | 3432 KiB | ||||
50 | Accepted | 517ms | 3208 KiB | ||||
51 | Accepted | 17ms | 3128 KiB | ||||
52 | Accepted | 115ms | 3128 KiB | ||||
53 | Accepted | 17ms | 3128 KiB | ||||
54 | Accepted | 21ms | 3128 KiB | ||||
55 | Accepted | 70ms | 3204 KiB | ||||
56 | Accepted | 555ms | 3464 KiB | ||||
57 | Accepted | 17ms | 3608 KiB | ||||
58 | Accepted | 17ms | 3564 KiB | ||||
59 | Accepted | 17ms | 3568 KiB | ||||
60 | Accepted | 23ms | 3216 KiB | ||||
61 | Accepted | 21ms | 3400 KiB | ||||
62 | Accepted | 23ms | 3232 KiB | ||||
63 | Accepted | 21ms | 3224 KiB | ||||
64 | Accepted | 531ms | 3384 KiB | ||||
65 | Accepted | 531ms | 3384 KiB | ||||
66 | Accepted | 518ms | 3388 KiB |