11970 | 2024-11-22 14:55:03 | tiktakbumbum12 | Számjegycsere | pypy3 | Accepted 100/100 | 531ms | 30700 KiB |
T = int(input())
for i in range(T):
N = input()
v = -1
nullas = N.count('0')
if len(N) >= 2:
if N[-2:] in ['00','25', '50', '75']:
v = 0
elif N[-2:] in ['52', '05', '57']:
v = 1
elif N[-1] == '5' and (('2' in N) or ('7' in N)):
v = 1
elif N[-1] == '0' and (('5' in N) or nullas >= 2):
v = 1
elif N[-2] in '72' and '5' in N:
v = 1
elif N[-2] == '5' and '0' in N:
v = 1
elif N[-2] == '0' and nullas >= 2:
v = 1
elif ('5' in N) and (('2' in N) or ('7' in N) or ('0' in N)):
v = 2
elif nullas >= 2:
v = 2
print(v)
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 45ms | 19440 KiB | ||||
subtask2 | 21/21 | ||||||
2 | Accepted | 305ms | 27116 KiB | ||||
subtask3 | 23/23 | ||||||
3 | Accepted | 531ms | 28832 KiB | ||||
4 | Accepted | 495ms | 29304 KiB | ||||
5 | Accepted | 430ms | 27860 KiB | ||||
6 | Accepted | 504ms | 30164 KiB | ||||
7 | Accepted | 492ms | 29168 KiB | ||||
8 | Accepted | 462ms | 27624 KiB | ||||
9 | Accepted | 503ms | 29236 KiB | ||||
10 | Accepted | 449ms | 28224 KiB | ||||
11 | Accepted | 495ms | 29424 KiB | ||||
12 | Accepted | 503ms | 29352 KiB | ||||
13 | Accepted | 430ms | 27760 KiB | ||||
14 | Accepted | 442ms | 28156 KiB | ||||
15 | Accepted | 499ms | 30700 KiB | ||||
16 | Accepted | 490ms | 27628 KiB | ||||
17 | Accepted | 458ms | 28140 KiB | ||||
18 | Accepted | 453ms | 28372 KiB | ||||
19 | Accepted | 407ms | 24812 KiB | ||||
20 | Accepted | 423ms | 25008 KiB | ||||
21 | Accepted | 437ms | 27624 KiB | ||||
22 | Accepted | 490ms | 29948 KiB | ||||
23 | Accepted | 470ms | 29928 KiB | ||||
subtask4 | 41/41 | ||||||
24 | Accepted | 45ms | 19676 KiB | ||||
25 | Accepted | 41ms | 19688 KiB | ||||
26 | Accepted | 45ms | 19700 KiB | ||||
27 | Accepted | 41ms | 19676 KiB | ||||
28 | Accepted | 46ms | 19596 KiB | ||||
29 | Accepted | 41ms | 19668 KiB | ||||
30 | Accepted | 43ms | 19692 KiB | ||||
31 | Accepted | 39ms | 19668 KiB | ||||
32 | Accepted | 41ms | 19696 KiB | ||||
33 | Accepted | 46ms | 19636 KiB | ||||
34 | Accepted | 43ms | 19560 KiB | ||||
35 | Accepted | 48ms | 21308 KiB | ||||
36 | Accepted | 79ms | 21484 KiB | ||||
37 | Accepted | 103ms | 23012 KiB | ||||
38 | Accepted | 46ms | 21312 KiB | ||||
39 | Accepted | 54ms | 21428 KiB | ||||
40 | Accepted | 48ms | 21232 KiB | ||||
41 | Accepted | 54ms | 21252 KiB | ||||
42 | Accepted | 79ms | 21492 KiB | ||||
43 | Accepted | 71ms | 21480 KiB | ||||
44 | Accepted | 79ms | 21608 KiB | ||||
45 | Accepted | 72ms | 21484 KiB | ||||
46 | Accepted | 54ms | 21228 KiB | ||||
47 | Accepted | 71ms | 21484 KiB | ||||
subtask5 | 15/15 | ||||||
48 | Accepted | 81ms | 21468 KiB | ||||
49 | Accepted | 46ms | 21768 KiB | ||||
50 | Accepted | 486ms | 28876 KiB | ||||
51 | Accepted | 54ms | 21620 KiB | ||||
52 | Accepted | 195ms | 25068 KiB | ||||
53 | Accepted | 63ms | 21348 KiB | ||||
54 | Accepted | 85ms | 21488 KiB | ||||
55 | Accepted | 134ms | 23788 KiB | ||||
56 | Accepted | 331ms | 23544 KiB | ||||
57 | Accepted | 46ms | 21744 KiB | ||||
58 | Accepted | 54ms | 21704 KiB | ||||
59 | Accepted | 54ms | 21808 KiB | ||||
60 | Accepted | 75ms | 21556 KiB | ||||
61 | Accepted | 83ms | 21484 KiB | ||||
62 | Accepted | 86ms | 21484 KiB | ||||
63 | Accepted | 76ms | 21676 KiB | ||||
64 | Accepted | 307ms | 23424 KiB | ||||
65 | Accepted | 312ms | 23824 KiB | ||||
66 | Accepted | 312ms | 23532 KiB |