11107 | 2024-07-07 00:48:48 | proba | Számjegycsere | python3 | Wrong answer 0/100 | 301ms | 3320 KiB |
import sys
# uncomment the two following lines if you want to read/write from files
# sys.stdin = open('input.txt')
# sys.stdout = open('output.txt', 'w')
T = int(input().strip())
for test in range(1, T+1):
N = input().strip()
ans = 0
#-----------------------------------
# INSERT YOUR CODE HERE
i = int(N)
# osztható 25-tel
if i % 25 == 0:
ans = 0
else:
s = str(i)
m = 0
# van benne 5-ös továbbá 2 vagy 7-es
if '5' in s and ('2' in s or '7' in s):
if s[-1]=='5' or s[-2:]=='57' or s[-2:]=='52' or s[-2]=='7' or s[-2]=='2':
m = 1
else:
m = 2
# van benne 5-ös és 0
if '0' in s and '5' in s:
if s[-2:] == '05' or s[-1]=='0' or s[-2]=='5':
m = 1
else:
if m == 0:
m = 2
# ha van benne 2 nulla
if s.count('0')>1:
if s[-2:].count('0')==1:
m = 1
else:
if m == 0:
m = 2
if m == 0:
ans = -1
else:
ans = m
#-----------------------------------
print(ans)
sys.stdout.close()
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Wrong answer | 17ms | 3044 KiB | ||||
subtask2 | 0/21 | ||||||
2 | Wrong answer | 104ms | 3044 KiB | ||||
subtask3 | 0/23 | ||||||
3 | Wrong answer | 241ms | 3044 KiB | ||||
4 | Wrong answer | 246ms | 3088 KiB | ||||
5 | Wrong answer | 252ms | 3044 KiB | ||||
6 | Wrong answer | 240ms | 3044 KiB | ||||
7 | Wrong answer | 247ms | 3044 KiB | ||||
8 | Wrong answer | 284ms | 3044 KiB | ||||
9 | Wrong answer | 241ms | 3044 KiB | ||||
10 | Wrong answer | 250ms | 3108 KiB | ||||
11 | Wrong answer | 254ms | 3044 KiB | ||||
12 | Wrong answer | 244ms | 3048 KiB | ||||
13 | Wrong answer | 279ms | 3044 KiB | ||||
14 | Wrong answer | 252ms | 3192 KiB | ||||
15 | Wrong answer | 254ms | 3188 KiB | ||||
16 | Wrong answer | 301ms | 3044 KiB | ||||
17 | Wrong answer | 250ms | 3180 KiB | ||||
18 | Wrong answer | 250ms | 3044 KiB | ||||
19 | Wrong answer | 282ms | 3044 KiB | ||||
20 | Wrong answer | 284ms | 3044 KiB | ||||
21 | Wrong answer | 250ms | 3044 KiB | ||||
22 | Wrong answer | 246ms | 3240 KiB | ||||
23 | Wrong answer | 247ms | 3044 KiB | ||||
subtask4 | 0/41 | ||||||
24 | Wrong answer | 18ms | 3192 KiB | ||||
25 | Wrong answer | 17ms | 3044 KiB | ||||
26 | Wrong answer | 18ms | 3068 KiB | ||||
27 | Wrong answer | 18ms | 3216 KiB | ||||
28 | Wrong answer | 18ms | 3044 KiB | ||||
29 | Wrong answer | 17ms | 3044 KiB | ||||
30 | Wrong answer | 18ms | 3044 KiB | ||||
31 | Wrong answer | 18ms | 3192 KiB | ||||
32 | Wrong answer | 17ms | 3044 KiB | ||||
33 | Wrong answer | 17ms | 3064 KiB | ||||
34 | Wrong answer | 18ms | 3064 KiB | ||||
35 | Wrong answer | 17ms | 3088 KiB | ||||
36 | Wrong answer | 19ms | 3056 KiB | ||||
37 | Wrong answer | 37ms | 3192 KiB | ||||
38 | Wrong answer | 18ms | 3044 KiB | ||||
39 | Wrong answer | 17ms | 3064 KiB | ||||
40 | Wrong answer | 18ms | 2924 KiB | ||||
41 | Wrong answer | 17ms | 2984 KiB | ||||
42 | Wrong answer | 19ms | 2992 KiB | ||||
43 | Wrong answer | 19ms | 3172 KiB | ||||
44 | Wrong answer | 19ms | 3064 KiB | ||||
45 | Wrong answer | 19ms | 3064 KiB | ||||
46 | Wrong answer | 17ms | 3044 KiB | ||||
47 | Wrong answer | 20ms | 3196 KiB | ||||
subtask5 | 0/15 | ||||||
48 | Wrong answer | 59ms | 3072 KiB | ||||
49 | Runtime error | 18ms | 3176 KiB | ||||
50 | Wrong answer | 298ms | 3052 KiB | ||||
51 | Runtime error | 18ms | 3116 KiB | ||||
52 | Wrong answer | 98ms | 3064 KiB | ||||
53 | Runtime error | 18ms | 3212 KiB | ||||
54 | Wrong answer | 54ms | 3192 KiB | ||||
55 | Wrong answer | 50ms | 3064 KiB | ||||
56 | Wrong answer | 238ms | 3064 KiB | ||||
57 | Runtime error | 17ms | 3320 KiB | ||||
58 | Runtime error | 17ms | 3216 KiB | ||||
59 | Runtime error | 17ms | 3172 KiB | ||||
60 | Wrong answer | 56ms | 2924 KiB | ||||
61 | Wrong answer | 56ms | 3172 KiB | ||||
62 | Wrong answer | 56ms | 3172 KiB | ||||
63 | Wrong answer | 56ms | 3044 KiB | ||||
64 | Wrong answer | 231ms | 3056 KiB | ||||
65 | Wrong answer | 238ms | 3172 KiB | ||||
66 | Wrong answer | 229ms | 3044 KiB |