11887 | 2024-11-15 15:31:09 | matthias | Számjegycsere | python3 | Accepted 100/100 | 574ms | 3560 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 | 14ms | 3128 KiB | ||||
subtask2 | 21/21 | ||||||
2 | Accepted | 175ms | 3128 KiB | ||||
subtask3 | 23/23 | ||||||
3 | Accepted | 514ms | 3384 KiB | ||||
4 | Accepted | 532ms | 3384 KiB | ||||
5 | Accepted | 507ms | 3236 KiB | ||||
6 | Accepted | 522ms | 3476 KiB | ||||
7 | Accepted | 524ms | 3444 KiB | ||||
8 | Accepted | 574ms | 3208 KiB | ||||
9 | Accepted | 532ms | 3440 KiB | ||||
10 | Accepted | 532ms | 3448 KiB | ||||
11 | Accepted | 515ms | 3436 KiB | ||||
12 | Accepted | 508ms | 3384 KiB | ||||
13 | Accepted | 517ms | 3248 KiB | ||||
14 | Accepted | 512ms | 3444 KiB | ||||
15 | Accepted | 519ms | 3384 KiB | ||||
16 | Accepted | 526ms | 3384 KiB | ||||
17 | Accepted | 526ms | 3436 KiB | ||||
18 | Accepted | 524ms | 3384 KiB | ||||
19 | Accepted | 515ms | 3272 KiB | ||||
20 | Accepted | 521ms | 3384 KiB | ||||
21 | Accepted | 519ms | 3384 KiB | ||||
22 | Accepted | 527ms | 3264 KiB | ||||
23 | Accepted | 493ms | 3384 KiB | ||||
subtask4 | 41/41 | ||||||
24 | Accepted | 16ms | 3064 KiB | ||||
25 | Accepted | 16ms | 3124 KiB | ||||
26 | Accepted | 16ms | 3128 KiB | ||||
27 | Accepted | 16ms | 3124 KiB | ||||
28 | Accepted | 16ms | 3260 KiB | ||||
29 | Accepted | 16ms | 3052 KiB | ||||
30 | Accepted | 16ms | 3180 KiB | ||||
31 | Accepted | 14ms | 2980 KiB | ||||
32 | Accepted | 14ms | 3040 KiB | ||||
33 | Accepted | 16ms | 2992 KiB | ||||
34 | Accepted | 16ms | 3184 KiB | ||||
35 | Accepted | 17ms | 3312 KiB | ||||
36 | Accepted | 21ms | 3180 KiB | ||||
37 | Accepted | 57ms | 3172 KiB | ||||
38 | Accepted | 17ms | 2984 KiB | ||||
39 | Accepted | 16ms | 3184 KiB | ||||
40 | Accepted | 17ms | 3128 KiB | ||||
41 | Accepted | 17ms | 3108 KiB | ||||
42 | Accepted | 19ms | 2996 KiB | ||||
43 | Accepted | 20ms | 3176 KiB | ||||
44 | Accepted | 21ms | 3092 KiB | ||||
45 | Accepted | 20ms | 3132 KiB | ||||
46 | Accepted | 16ms | 3012 KiB | ||||
47 | Accepted | 20ms | 3128 KiB | ||||
subtask5 | 15/15 | ||||||
48 | Accepted | 25ms | 3040 KiB | ||||
49 | Accepted | 19ms | 3560 KiB | ||||
50 | Accepted | 541ms | 3428 KiB | ||||
51 | Accepted | 19ms | 3196 KiB | ||||
52 | Accepted | 119ms | 3128 KiB | ||||
53 | Accepted | 17ms | 3132 KiB | ||||
54 | Accepted | 23ms | 3068 KiB | ||||
55 | Accepted | 68ms | 3192 KiB | ||||
56 | Accepted | 529ms | 3456 KiB | ||||
57 | Accepted | 19ms | 3520 KiB | ||||
58 | Accepted | 17ms | 3560 KiB | ||||
59 | Accepted | 17ms | 3560 KiB | ||||
60 | Accepted | 21ms | 3124 KiB | ||||
61 | Accepted | 23ms | 3188 KiB | ||||
62 | Accepted | 23ms | 3132 KiB | ||||
63 | Accepted | 21ms | 3128 KiB | ||||
64 | Accepted | 523ms | 3384 KiB | ||||
65 | Accepted | 518ms | 3324 KiB | ||||
66 | Accepted | 497ms | 3384 KiB |