11602 | 2024-10-29 23:39:40 | Kezdő | Számjegycsere | python3 | Accepted 100/100 | 564ms | 3648 KiB |
T = int(input())
for i in range(T):
N = input()
##s = [300,325,50,75,215,6715,540,20040,520,5073,205,2003,157,1001,152,7500,7005,200253,52,22,10011,55,505]
##for x in s:
## N = str(x)
v = -1
nul = 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 nul >= 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 nul >= 2:
v = 1
elif ('5' in N) and (('2' in N) or ('7' in N) or ('0' in N)):
v = 2
elif nul >= 2:
v = 2
print(v)
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 14ms | 3112 KiB | ||||
subtask2 | 21/21 | ||||||
2 | Accepted | 180ms | 3128 KiB | ||||
subtask3 | 23/23 | ||||||
3 | Accepted | 518ms | 3384 KiB | ||||
4 | Accepted | 523ms | 3384 KiB | ||||
5 | Accepted | 524ms | 3384 KiB | ||||
6 | Accepted | 510ms | 3248 KiB | ||||
7 | Accepted | 518ms | 3384 KiB | ||||
8 | Accepted | 564ms | 3248 KiB | ||||
9 | Accepted | 522ms | 3400 KiB | ||||
10 | Accepted | 527ms | 3376 KiB | ||||
11 | Accepted | 515ms | 3304 KiB | ||||
12 | Accepted | 521ms | 3448 KiB | ||||
13 | Accepted | 519ms | 3384 KiB | ||||
14 | Accepted | 528ms | 3384 KiB | ||||
15 | Accepted | 521ms | 3384 KiB | ||||
16 | Accepted | 523ms | 3368 KiB | ||||
17 | Accepted | 521ms | 3436 KiB | ||||
18 | Accepted | 523ms | 3268 KiB | ||||
19 | Accepted | 528ms | 3384 KiB | ||||
20 | Accepted | 518ms | 3212 KiB | ||||
21 | Accepted | 523ms | 3256 KiB | ||||
22 | Accepted | 521ms | 3384 KiB | ||||
23 | Accepted | 504ms | 3444 KiB | ||||
subtask4 | 41/41 | ||||||
24 | Accepted | 17ms | 3124 KiB | ||||
25 | Accepted | 17ms | 3144 KiB | ||||
26 | Accepted | 17ms | 3120 KiB | ||||
27 | Accepted | 17ms | 3132 KiB | ||||
28 | Accepted | 16ms | 3168 KiB | ||||
29 | Accepted | 17ms | 2988 KiB | ||||
30 | Accepted | 16ms | 3128 KiB | ||||
31 | Accepted | 16ms | 3096 KiB | ||||
32 | Accepted | 17ms | 3128 KiB | ||||
33 | Accepted | 17ms | 3140 KiB | ||||
34 | Accepted | 17ms | 3120 KiB | ||||
35 | Accepted | 17ms | 3128 KiB | ||||
36 | Accepted | 21ms | 3172 KiB | ||||
37 | Accepted | 54ms | 3212 KiB | ||||
38 | Accepted | 16ms | 3032 KiB | ||||
39 | Accepted | 17ms | 3036 KiB | ||||
40 | Accepted | 17ms | 3172 KiB | ||||
41 | Accepted | 17ms | 3132 KiB | ||||
42 | Accepted | 20ms | 2960 KiB | ||||
43 | Accepted | 20ms | 3128 KiB | ||||
44 | Accepted | 21ms | 3076 KiB | ||||
45 | Accepted | 21ms | 3128 KiB | ||||
46 | Accepted | 16ms | 3000 KiB | ||||
47 | Accepted | 19ms | 3128 KiB | ||||
subtask5 | 15/15 | ||||||
48 | Accepted | 25ms | 3060 KiB | ||||
49 | Accepted | 19ms | 3508 KiB | ||||
50 | Accepted | 509ms | 3188 KiB | ||||
51 | Accepted | 19ms | 3232 KiB | ||||
52 | Accepted | 120ms | 3132 KiB | ||||
53 | Accepted | 17ms | 3136 KiB | ||||
54 | Accepted | 23ms | 3188 KiB | ||||
55 | Accepted | 70ms | 3188 KiB | ||||
56 | Accepted | 521ms | 3480 KiB | ||||
57 | Accepted | 20ms | 3648 KiB | ||||
58 | Accepted | 17ms | 3452 KiB | ||||
59 | Accepted | 18ms | 3472 KiB | ||||
60 | Accepted | 21ms | 3024 KiB | ||||
61 | Accepted | 24ms | 3060 KiB | ||||
62 | Accepted | 23ms | 3140 KiB | ||||
63 | Accepted | 24ms | 3212 KiB | ||||
64 | Accepted | 564ms | 3468 KiB | ||||
65 | Accepted | 523ms | 3384 KiB | ||||
66 | Accepted | 501ms | 3364 KiB |