111102024-07-07 01:00:04probaSzámjegycserepython3Wrong answer 0/100822ms4400 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()


SubtaskSumTestVerdictTimeMemory
subtask10/0
1Wrong answer17ms3044 KiB
subtask20/21
2Wrong answer256ms3300 KiB
subtask30/23
3Wrong answer725ms3448 KiB
4Wrong answer779ms3468 KiB
5Wrong answer768ms3560 KiB
6Wrong answer787ms3560 KiB
7Wrong answer760ms3504 KiB
8Wrong answer806ms3684 KiB
9Wrong answer728ms3704 KiB
10Wrong answer804ms3556 KiB
11Wrong answer718ms3556 KiB
12Wrong answer708ms3556 KiB
13Wrong answer792ms3684 KiB
14Wrong answer758ms3556 KiB
15Wrong answer717ms3556 KiB
16Wrong answer822ms3812 KiB
17Wrong answer787ms3556 KiB
18Wrong answer794ms3556 KiB
19Wrong answer763ms3684 KiB
20Wrong answer778ms3684 KiB
21Wrong answer758ms3556 KiB
22Wrong answer760ms3552 KiB
23Wrong answer628ms3556 KiB
subtask40/41
24Accepted17ms3044 KiB
25Accepted17ms3044 KiB
26Accepted18ms3236 KiB
27Accepted17ms3184 KiB
28Accepted17ms3088 KiB
29Accepted18ms3192 KiB
30Accepted17ms3044 KiB
31Accepted17ms3044 KiB
32Accepted18ms2968 KiB
33Wrong answer18ms3180 KiB
34Accepted17ms3196 KiB
35Accepted18ms3044 KiB
36Accepted23ms3044 KiB
37Accepted75ms3080 KiB
38Accepted19ms3156 KiB
39Accepted18ms3064 KiB
40Accepted17ms3044 KiB
41Accepted17ms3044 KiB
42Accepted23ms2916 KiB
43Accepted24ms3044 KiB
44Accepted23ms3064 KiB
45Accepted23ms3192 KiB
46Wrong answer17ms3192 KiB
47Wrong answer24ms3044 KiB
subtask50/15
48Wrong answer30ms3048 KiB
49Wrong answer23ms4248 KiB
50Wrong answer787ms3684 KiB
51Wrong answer25ms4400 KiB
52Wrong answer186ms3120 KiB
53Accepted21ms4112 KiB
54Accepted26ms3192 KiB
55Accepted86ms3160 KiB
56Accepted674ms3404 KiB
57Accepted19ms4308 KiB
58Accepted19ms4180 KiB
59Accepted19ms4180 KiB
60Accepted27ms3044 KiB
61Accepted27ms3044 KiB
62Accepted27ms3192 KiB
63Accepted27ms3044 KiB
64Accepted634ms3464 KiB
65Accepted625ms3232 KiB
66Accepted606ms3476 KiB