12211 | 2024-12-09 12:58:40 | Csongi | Számjegycsere | python3 | Accepted 100/100 | 541ms | 3660 KiB |
t = int(input())
for x in range(t):
n = input()
bnull = n.count('0') >= 2
if len(n) >= 2:
if n[-2:] in ['00', '75', '50', '25']:
print("0")
elif n[-2:] in ['05', '52', '57']:
print("1")
elif n[-1] == '5' and (('2' in n) or ('7' in n)):
print("1")
elif n[-1] == '0' and (('5' in n) or bnull):
print("1")
elif n[-2] in '72' and '5' in n:
print("1")
elif n[-2] == '5' and '0' in n:
print("1")
elif n[-2] == '0' and bnull:
print("1")
elif ('5' in n) and (('2' in n) or ('7' in n) or ('0' in n)):
print("2")
elif bnull:
print("2")
else:
print("-1")
else:
print("-1")
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 16ms | 3128 KiB | ||||
subtask2 | 21/21 | ||||||
2 | Accepted | 172ms | 3092 KiB | ||||
subtask3 | 23/23 | ||||||
3 | Accepted | 508ms | 3400 KiB | ||||
4 | Accepted | 523ms | 3388 KiB | ||||
5 | Accepted | 509ms | 3440 KiB | ||||
6 | Accepted | 509ms | 3376 KiB | ||||
7 | Accepted | 513ms | 3376 KiB | ||||
8 | Accepted | 509ms | 3384 KiB | ||||
9 | Accepted | 510ms | 3384 KiB | ||||
10 | Accepted | 541ms | 3452 KiB | ||||
11 | Accepted | 508ms | 3384 KiB | ||||
12 | Accepted | 518ms | 3384 KiB | ||||
13 | Accepted | 505ms | 3196 KiB | ||||
14 | Accepted | 507ms | 3384 KiB | ||||
15 | Accepted | 504ms | 3384 KiB | ||||
16 | Accepted | 523ms | 3396 KiB | ||||
17 | Accepted | 512ms | 3452 KiB | ||||
18 | Accepted | 509ms | 3384 KiB | ||||
19 | Accepted | 512ms | 3384 KiB | ||||
20 | Accepted | 493ms | 3196 KiB | ||||
21 | Accepted | 515ms | 3384 KiB | ||||
22 | Accepted | 504ms | 3384 KiB | ||||
23 | Accepted | 493ms | 3384 KiB | ||||
subtask4 | 41/41 | ||||||
24 | Accepted | 16ms | 3320 KiB | ||||
25 | Accepted | 16ms | 3312 KiB | ||||
26 | Accepted | 16ms | 3128 KiB | ||||
27 | Accepted | 16ms | 3324 KiB | ||||
28 | Accepted | 17ms | 3132 KiB | ||||
29 | Accepted | 16ms | 2980 KiB | ||||
30 | Accepted | 16ms | 3128 KiB | ||||
31 | Accepted | 16ms | 3140 KiB | ||||
32 | Accepted | 16ms | 3124 KiB | ||||
33 | Accepted | 16ms | 3144 KiB | ||||
34 | Accepted | 16ms | 3120 KiB | ||||
35 | Accepted | 16ms | 3124 KiB | ||||
36 | Accepted | 20ms | 3188 KiB | ||||
37 | Accepted | 54ms | 3012 KiB | ||||
38 | Accepted | 16ms | 3188 KiB | ||||
39 | Accepted | 16ms | 3192 KiB | ||||
40 | Accepted | 16ms | 3132 KiB | ||||
41 | Accepted | 16ms | 3072 KiB | ||||
42 | Accepted | 20ms | 2996 KiB | ||||
43 | Accepted | 19ms | 3132 KiB | ||||
44 | Accepted | 19ms | 3092 KiB | ||||
45 | Accepted | 20ms | 2968 KiB | ||||
46 | Accepted | 17ms | 2976 KiB | ||||
47 | Accepted | 19ms | 3092 KiB | ||||
subtask5 | 15/15 | ||||||
48 | Accepted | 24ms | 3128 KiB | ||||
49 | Accepted | 19ms | 3488 KiB | ||||
50 | Accepted | 515ms | 3428 KiB | ||||
51 | Accepted | 20ms | 3128 KiB | ||||
52 | Accepted | 119ms | 3216 KiB | ||||
53 | Accepted | 18ms | 3124 KiB | ||||
54 | Accepted | 21ms | 3064 KiB | ||||
55 | Accepted | 68ms | 3212 KiB | ||||
56 | Accepted | 526ms | 3384 KiB | ||||
57 | Accepted | 19ms | 3560 KiB | ||||
58 | Accepted | 17ms | 3552 KiB | ||||
59 | Accepted | 17ms | 3660 KiB | ||||
60 | Accepted | 23ms | 3128 KiB | ||||
61 | Accepted | 23ms | 3132 KiB | ||||
62 | Accepted | 23ms | 3196 KiB | ||||
63 | Accepted | 23ms | 3200 KiB | ||||
64 | Accepted | 513ms | 3276 KiB | ||||
65 | Accepted | 504ms | 3296 KiB | ||||
66 | Accepted | 509ms | 3384 KiB |