111092024-07-07 00:56:01probaSzámjegycserepython3Wrong answer 0/100298ms3312 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 answer237ms3260 KiB
4Wrong answer245ms3220 KiB
5Wrong answer246ms3044 KiB
6Wrong answer245ms3088 KiB
7Wrong answer247ms3044 KiB
8Wrong answer286ms3044 KiB
9Wrong answer250ms3172 KiB
10Wrong answer248ms3044 KiB
11Wrong answer244ms3044 KiB
12Wrong answer243ms3044 KiB
13Wrong answer264ms3216 KiB
14Wrong answer250ms3152 KiB
15Wrong answer245ms3172 KiB
16Wrong answer287ms3192 KiB
17Wrong answer246ms3060 KiB
18Wrong answer259ms3044 KiB
19Wrong answer275ms3044 KiB
20Wrong answer280ms3172 KiB
21Wrong answer256ms3176 KiB
22Wrong answer247ms3172 KiB
23Wrong answer240ms3044 KiB
subtask40/41
24Wrong answer18ms3044 KiB
25Wrong answer17ms3044 KiB
26Wrong answer17ms3044 KiB
27Wrong answer18ms3044 KiB
28Wrong answer18ms2916 KiB
29Wrong answer18ms3044 KiB
30Wrong answer17ms3044 KiB
31Wrong answer17ms3044 KiB
32Wrong answer18ms3096 KiB
33Wrong answer17ms3044 KiB
34Wrong answer18ms2972 KiB
35Wrong answer17ms3192 KiB
36Wrong answer19ms2972 KiB
37Wrong answer37ms3048 KiB
38Wrong answer17ms3044 KiB
39Wrong answer18ms2956 KiB
40Wrong answer17ms3048 KiB
41Wrong answer17ms3080 KiB
42Wrong answer21ms2972 KiB
43Wrong answer19ms3188 KiB
44Wrong answer19ms3044 KiB
45Wrong answer19ms2972 KiB
46Wrong answer17ms3044 KiB
47Wrong answer20ms3192 KiB
subtask50/15
48Wrong answer59ms3192 KiB
49Runtime error18ms3312 KiB
50Wrong answer298ms3208 KiB
51Runtime error17ms3172 KiB
52Wrong answer100ms3044 KiB
53Runtime error18ms3044 KiB
54Wrong answer56ms3044 KiB
55Wrong answer50ms3064 KiB
56Wrong answer231ms3148 KiB
57Runtime error17ms3192 KiB
58Runtime error18ms3300 KiB
59Runtime error17ms3308 KiB
60Wrong answer56ms3224 KiB
61Wrong answer56ms3064 KiB
62Wrong answer54ms3044 KiB
63Wrong answer57ms3044 KiB
64Wrong answer224ms3044 KiB
65Wrong answer236ms3044 KiB
66Wrong answer229ms3172 KiB