111082024-07-07 00:55:18probaSzámjegycserepython3Wrong answer 0/100298ms3320 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 answer108ms3044 KiB
subtask30/23
3Wrong answer238ms3048 KiB
4Wrong answer246ms3096 KiB
5Wrong answer247ms3172 KiB
6Wrong answer250ms3080 KiB
7Wrong answer243ms3044 KiB
8Wrong answer291ms3188 KiB
9Wrong answer244ms3044 KiB
10Wrong answer250ms3044 KiB
11Wrong answer240ms3044 KiB
12Wrong answer239ms3308 KiB
13Wrong answer272ms3044 KiB
14Wrong answer252ms3108 KiB
15Wrong answer250ms3044 KiB
16Wrong answer298ms3044 KiB
17Wrong answer252ms3044 KiB
18Wrong answer250ms3192 KiB
19Wrong answer277ms3156 KiB
20Wrong answer282ms3172 KiB
21Wrong answer254ms3172 KiB
22Wrong answer252ms3192 KiB
23Wrong answer250ms3044 KiB
subtask40/41
24Wrong answer18ms3192 KiB
25Wrong answer18ms3236 KiB
26Wrong answer17ms3100 KiB
27Wrong answer18ms3088 KiB
28Wrong answer18ms3044 KiB
29Wrong answer18ms3188 KiB
30Wrong answer18ms3320 KiB
31Wrong answer17ms2916 KiB
32Wrong answer19ms3044 KiB
33Wrong answer17ms3020 KiB
34Wrong answer17ms3088 KiB
35Wrong answer18ms3060 KiB
36Wrong answer20ms3044 KiB
37Wrong answer39ms3044 KiB
38Wrong answer17ms3044 KiB
39Wrong answer17ms3048 KiB
40Wrong answer17ms3064 KiB
41Wrong answer18ms3108 KiB
42Wrong answer19ms3044 KiB
43Wrong answer20ms3044 KiB
44Wrong answer19ms3016 KiB
45Wrong answer20ms3172 KiB
46Wrong answer17ms3084 KiB
47Wrong answer20ms3044 KiB
subtask50/15
48Wrong answer59ms3308 KiB
49Runtime error18ms3176 KiB
50Wrong answer298ms3048 KiB
51Runtime error17ms3320 KiB
52Wrong answer98ms3044 KiB
53Runtime error17ms3192 KiB
54Wrong answer54ms3044 KiB
55Wrong answer50ms3064 KiB
56Wrong answer234ms3192 KiB
57Runtime error17ms3300 KiB
58Runtime error17ms3300 KiB
59Runtime error18ms3172 KiB
60Wrong answer54ms3044 KiB
61Wrong answer57ms3260 KiB
62Wrong answer56ms3192 KiB
63Wrong answer54ms3320 KiB
64Wrong answer231ms3044 KiB
65Wrong answer236ms3052 KiB
66Wrong answer230ms3008 KiB