11111 | 2024-07-07 01:05:46 | proba | Számjegycsere | python3 | Wrong answer 0/100 | 842ms | 3812 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
try:
i = int(N)
if i % 25 == 0:
ans = 0
# osztható 25-tel
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 = print(m)
print(ans)
except:
print(-1)
#-----------------------------------
sys.stdout.close()
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Wrong answer | 17ms | 3048 KiB | ||||
subtask2 | 0/21 | ||||||
2 | Wrong answer | 261ms | 3300 KiB | ||||
subtask3 | 0/23 | ||||||
3 | Wrong answer | 754ms | 3544 KiB | ||||
4 | Wrong answer | 792ms | 3600 KiB | ||||
5 | Wrong answer | 800ms | 3600 KiB | ||||
6 | Wrong answer | 762ms | 3592 KiB | ||||
7 | Wrong answer | 718ms | 3556 KiB | ||||
8 | Wrong answer | 783ms | 3684 KiB | ||||
9 | Wrong answer | 712ms | 3684 KiB | ||||
10 | Wrong answer | 800ms | 3600 KiB | ||||
11 | Wrong answer | 731ms | 3556 KiB | ||||
12 | Wrong answer | 726ms | 3684 KiB | ||||
13 | Wrong answer | 813ms | 3812 KiB | ||||
14 | Wrong answer | 787ms | 3704 KiB | ||||
15 | Wrong answer | 732ms | 3556 KiB | ||||
16 | Wrong answer | 842ms | 3684 KiB | ||||
17 | Wrong answer | 800ms | 3600 KiB | ||||
18 | Wrong answer | 781ms | 3556 KiB | ||||
19 | Wrong answer | 774ms | 3684 KiB | ||||
20 | Wrong answer | 791ms | 3684 KiB | ||||
21 | Wrong answer | 814ms | 3592 KiB | ||||
22 | Wrong answer | 791ms | 3556 KiB | ||||
23 | Wrong answer | 629ms | 3556 KiB | ||||
subtask4 | 0/41 | ||||||
24 | Accepted | 17ms | 3084 KiB | ||||
25 | Accepted | 17ms | 3120 KiB | ||||
26 | Accepted | 18ms | 3328 KiB | ||||
27 | Accepted | 17ms | 3080 KiB | ||||
28 | Accepted | 18ms | 3044 KiB | ||||
29 | Accepted | 18ms | 3108 KiB | ||||
30 | Accepted | 17ms | 3044 KiB | ||||
31 | Accepted | 17ms | 3048 KiB | ||||
32 | Accepted | 17ms | 2992 KiB | ||||
33 | Wrong answer | 17ms | 3044 KiB | ||||
34 | Accepted | 17ms | 2996 KiB | ||||
35 | Accepted | 18ms | 3192 KiB | ||||
36 | Accepted | 24ms | 3048 KiB | ||||
37 | Accepted | 76ms | 3192 KiB | ||||
38 | Accepted | 19ms | 3064 KiB | ||||
39 | Accepted | 19ms | 3064 KiB | ||||
40 | Accepted | 18ms | 3016 KiB | ||||
41 | Accepted | 18ms | 3044 KiB | ||||
42 | Accepted | 25ms | 2916 KiB | ||||
43 | Accepted | 25ms | 3044 KiB | ||||
44 | Accepted | 25ms | 3044 KiB | ||||
45 | Accepted | 24ms | 2972 KiB | ||||
46 | Wrong answer | 18ms | 3044 KiB | ||||
47 | Wrong answer | 25ms | 3048 KiB | ||||
subtask5 | 0/15 | ||||||
48 | Wrong answer | 64ms | 3068 KiB | ||||
49 | Wrong answer | 19ms | 3604 KiB | ||||
50 | Wrong answer | 810ms | 3724 KiB | ||||
51 | Wrong answer | 41ms | 3220 KiB | ||||
52 | Wrong answer | 204ms | 3320 KiB | ||||
53 | Accepted | 19ms | 3172 KiB | ||||
54 | Accepted | 59ms | 3136 KiB | ||||
55 | Accepted | 101ms | 3172 KiB | ||||
56 | Accepted | 685ms | 3304 KiB | ||||
57 | Wrong answer | 20ms | 3604 KiB | ||||
58 | Accepted | 19ms | 3604 KiB | ||||
59 | Accepted | 19ms | 3604 KiB | ||||
60 | Accepted | 61ms | 3192 KiB | ||||
61 | Accepted | 61ms | 3044 KiB | ||||
62 | Accepted | 61ms | 3172 KiB | ||||
63 | Accepted | 61ms | 3172 KiB | ||||
64 | Accepted | 720ms | 3416 KiB | ||||
65 | Accepted | 685ms | 3556 KiB | ||||
66 | Accepted | 709ms | 3432 KiB |