11110 | 2024-07-07 01:00:04 | proba | Számjegycsere | python3 | Wrong answer 0/100 | 822ms | 4400 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 = N
# osztható 25-tel
if i[-2:] in ['25','00','75','50']:
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 = print(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 | 256ms | 3300 KiB | ||||
subtask3 | 0/23 | ||||||
3 | Wrong answer | 725ms | 3448 KiB | ||||
4 | Wrong answer | 779ms | 3468 KiB | ||||
5 | Wrong answer | 768ms | 3560 KiB | ||||
6 | Wrong answer | 787ms | 3560 KiB | ||||
7 | Wrong answer | 760ms | 3504 KiB | ||||
8 | Wrong answer | 806ms | 3684 KiB | ||||
9 | Wrong answer | 728ms | 3704 KiB | ||||
10 | Wrong answer | 804ms | 3556 KiB | ||||
11 | Wrong answer | 718ms | 3556 KiB | ||||
12 | Wrong answer | 708ms | 3556 KiB | ||||
13 | Wrong answer | 792ms | 3684 KiB | ||||
14 | Wrong answer | 758ms | 3556 KiB | ||||
15 | Wrong answer | 717ms | 3556 KiB | ||||
16 | Wrong answer | 822ms | 3812 KiB | ||||
17 | Wrong answer | 787ms | 3556 KiB | ||||
18 | Wrong answer | 794ms | 3556 KiB | ||||
19 | Wrong answer | 763ms | 3684 KiB | ||||
20 | Wrong answer | 778ms | 3684 KiB | ||||
21 | Wrong answer | 758ms | 3556 KiB | ||||
22 | Wrong answer | 760ms | 3552 KiB | ||||
23 | Wrong answer | 628ms | 3556 KiB | ||||
subtask4 | 0/41 | ||||||
24 | Accepted | 17ms | 3044 KiB | ||||
25 | Accepted | 17ms | 3044 KiB | ||||
26 | Accepted | 18ms | 3236 KiB | ||||
27 | Accepted | 17ms | 3184 KiB | ||||
28 | Accepted | 17ms | 3088 KiB | ||||
29 | Accepted | 18ms | 3192 KiB | ||||
30 | Accepted | 17ms | 3044 KiB | ||||
31 | Accepted | 17ms | 3044 KiB | ||||
32 | Accepted | 18ms | 2968 KiB | ||||
33 | Wrong answer | 18ms | 3180 KiB | ||||
34 | Accepted | 17ms | 3196 KiB | ||||
35 | Accepted | 18ms | 3044 KiB | ||||
36 | Accepted | 23ms | 3044 KiB | ||||
37 | Accepted | 75ms | 3080 KiB | ||||
38 | Accepted | 19ms | 3156 KiB | ||||
39 | Accepted | 18ms | 3064 KiB | ||||
40 | Accepted | 17ms | 3044 KiB | ||||
41 | Accepted | 17ms | 3044 KiB | ||||
42 | Accepted | 23ms | 2916 KiB | ||||
43 | Accepted | 24ms | 3044 KiB | ||||
44 | Accepted | 23ms | 3064 KiB | ||||
45 | Accepted | 23ms | 3192 KiB | ||||
46 | Wrong answer | 17ms | 3192 KiB | ||||
47 | Wrong answer | 24ms | 3044 KiB | ||||
subtask5 | 0/15 | ||||||
48 | Wrong answer | 30ms | 3048 KiB | ||||
49 | Wrong answer | 23ms | 4248 KiB | ||||
50 | Wrong answer | 787ms | 3684 KiB | ||||
51 | Wrong answer | 25ms | 4400 KiB | ||||
52 | Wrong answer | 186ms | 3120 KiB | ||||
53 | Accepted | 21ms | 4112 KiB | ||||
54 | Accepted | 26ms | 3192 KiB | ||||
55 | Accepted | 86ms | 3160 KiB | ||||
56 | Accepted | 674ms | 3404 KiB | ||||
57 | Accepted | 19ms | 4308 KiB | ||||
58 | Accepted | 19ms | 4180 KiB | ||||
59 | Accepted | 19ms | 4180 KiB | ||||
60 | Accepted | 27ms | 3044 KiB | ||||
61 | Accepted | 27ms | 3044 KiB | ||||
62 | Accepted | 27ms | 3192 KiB | ||||
63 | Accepted | 27ms | 3044 KiB | ||||
64 | Accepted | 634ms | 3464 KiB | ||||
65 | Accepted | 625ms | 3232 KiB | ||||
66 | Accepted | 606ms | 3476 KiB |