111072024-07-07 00:48:48probaSzámjegycserepython3Wrong answer 0/100301ms3320 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()


SubtaskSumTestVerdictTimeMemory
subtask10/0
1Wrong answer17ms3044 KiB
subtask20/21
2Wrong answer104ms3044 KiB
subtask30/23
3Wrong answer241ms3044 KiB
4Wrong answer246ms3088 KiB
5Wrong answer252ms3044 KiB
6Wrong answer240ms3044 KiB
7Wrong answer247ms3044 KiB
8Wrong answer284ms3044 KiB
9Wrong answer241ms3044 KiB
10Wrong answer250ms3108 KiB
11Wrong answer254ms3044 KiB
12Wrong answer244ms3048 KiB
13Wrong answer279ms3044 KiB
14Wrong answer252ms3192 KiB
15Wrong answer254ms3188 KiB
16Wrong answer301ms3044 KiB
17Wrong answer250ms3180 KiB
18Wrong answer250ms3044 KiB
19Wrong answer282ms3044 KiB
20Wrong answer284ms3044 KiB
21Wrong answer250ms3044 KiB
22Wrong answer246ms3240 KiB
23Wrong answer247ms3044 KiB
subtask40/41
24Wrong answer18ms3192 KiB
25Wrong answer17ms3044 KiB
26Wrong answer18ms3068 KiB
27Wrong answer18ms3216 KiB
28Wrong answer18ms3044 KiB
29Wrong answer17ms3044 KiB
30Wrong answer18ms3044 KiB
31Wrong answer18ms3192 KiB
32Wrong answer17ms3044 KiB
33Wrong answer17ms3064 KiB
34Wrong answer18ms3064 KiB
35Wrong answer17ms3088 KiB
36Wrong answer19ms3056 KiB
37Wrong answer37ms3192 KiB
38Wrong answer18ms3044 KiB
39Wrong answer17ms3064 KiB
40Wrong answer18ms2924 KiB
41Wrong answer17ms2984 KiB
42Wrong answer19ms2992 KiB
43Wrong answer19ms3172 KiB
44Wrong answer19ms3064 KiB
45Wrong answer19ms3064 KiB
46Wrong answer17ms3044 KiB
47Wrong answer20ms3196 KiB
subtask50/15
48Wrong answer59ms3072 KiB
49Runtime error18ms3176 KiB
50Wrong answer298ms3052 KiB
51Runtime error18ms3116 KiB
52Wrong answer98ms3064 KiB
53Runtime error18ms3212 KiB
54Wrong answer54ms3192 KiB
55Wrong answer50ms3064 KiB
56Wrong answer238ms3064 KiB
57Runtime error17ms3320 KiB
58Runtime error17ms3216 KiB
59Runtime error17ms3172 KiB
60Wrong answer56ms2924 KiB
61Wrong answer56ms3172 KiB
62Wrong answer56ms3172 KiB
63Wrong answer56ms3044 KiB
64Wrong answer231ms3056 KiB
65Wrong answer238ms3172 KiB
66Wrong answer229ms3044 KiB