11966 | 2024-11-22 14:52:54 | Adam | Számjegycsere | python3 | Accepted 100/100 | 564ms | 3664 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 | 16ms | 3064 KiB | ||||
subtask2 | 21/21 | ||||||
2 | Accepted | 175ms | 3128 KiB | ||||
subtask3 | 23/23 | ||||||
3 | Accepted | 518ms | 3388 KiB | ||||
4 | Accepted | 522ms | 3440 KiB | ||||
5 | Accepted | 564ms | 3384 KiB | ||||
6 | Accepted | 526ms | 3372 KiB | ||||
7 | Accepted | 515ms | 3452 KiB | ||||
8 | Accepted | 522ms | 3384 KiB | ||||
9 | Accepted | 518ms | 3368 KiB | ||||
10 | Accepted | 518ms | 3384 KiB | ||||
11 | Accepted | 526ms | 3384 KiB | ||||
12 | Accepted | 528ms | 3404 KiB | ||||
13 | Accepted | 509ms | 3440 KiB | ||||
14 | Accepted | 523ms | 3360 KiB | ||||
15 | Accepted | 504ms | 3432 KiB | ||||
16 | Accepted | 535ms | 3408 KiB | ||||
17 | Accepted | 528ms | 3320 KiB | ||||
18 | Accepted | 526ms | 3384 KiB | ||||
19 | Accepted | 535ms | 3384 KiB | ||||
20 | Accepted | 505ms | 3208 KiB | ||||
21 | Accepted | 514ms | 3428 KiB | ||||
22 | Accepted | 536ms | 3324 KiB | ||||
23 | Accepted | 500ms | 3464 KiB | ||||
subtask4 | 41/41 | ||||||
24 | Accepted | 17ms | 3128 KiB | ||||
25 | Accepted | 16ms | 3120 KiB | ||||
26 | Accepted | 16ms | 3320 KiB | ||||
27 | Accepted | 14ms | 3128 KiB | ||||
28 | Accepted | 16ms | 3124 KiB | ||||
29 | Accepted | 17ms | 3116 KiB | ||||
30 | Accepted | 16ms | 3128 KiB | ||||
31 | Accepted | 16ms | 3136 KiB | ||||
32 | Accepted | 14ms | 3180 KiB | ||||
33 | Accepted | 16ms | 3184 KiB | ||||
34 | Accepted | 16ms | 2964 KiB | ||||
35 | Accepted | 17ms | 2960 KiB | ||||
36 | Accepted | 20ms | 3180 KiB | ||||
37 | Accepted | 56ms | 3232 KiB | ||||
38 | Accepted | 16ms | 3128 KiB | ||||
39 | Accepted | 17ms | 3088 KiB | ||||
40 | Accepted | 16ms | 3320 KiB | ||||
41 | Accepted | 16ms | 3128 KiB | ||||
42 | Accepted | 20ms | 3180 KiB | ||||
43 | Accepted | 20ms | 3128 KiB | ||||
44 | Accepted | 20ms | 3188 KiB | ||||
45 | Accepted | 19ms | 3188 KiB | ||||
46 | Accepted | 17ms | 3184 KiB | ||||
47 | Accepted | 19ms | 3208 KiB | ||||
subtask5 | 15/15 | ||||||
48 | Accepted | 25ms | 3128 KiB | ||||
49 | Accepted | 19ms | 3664 KiB | ||||
50 | Accepted | 523ms | 3268 KiB | ||||
51 | Accepted | 21ms | 3200 KiB | ||||
52 | Accepted | 118ms | 3320 KiB | ||||
53 | Accepted | 17ms | 3228 KiB | ||||
54 | Accepted | 21ms | 3128 KiB | ||||
55 | Accepted | 68ms | 3012 KiB | ||||
56 | Accepted | 518ms | 3400 KiB | ||||
57 | Accepted | 18ms | 3560 KiB | ||||
58 | Accepted | 17ms | 3560 KiB | ||||
59 | Accepted | 17ms | 3660 KiB | ||||
60 | Accepted | 23ms | 3192 KiB | ||||
61 | Accepted | 21ms | 3196 KiB | ||||
62 | Accepted | 24ms | 3128 KiB | ||||
63 | Accepted | 21ms | 3128 KiB | ||||
64 | Accepted | 533ms | 3460 KiB | ||||
65 | Accepted | 528ms | 3444 KiB | ||||
66 | Accepted | 492ms | 3384 KiB |