110972024-07-06 22:53:25probaSzámjegycserepython3Wrong answer 0/100372ms7904 KiB
# 50, 00, 25, 75
lista = [int(input()) for i in range(int(input()))]
#lista = [157, 1001, 152, 7500, 7005, 2253, 52, 22, 10011, 55, 505]

for i in lista:
    # osztható 25-tel    
    if i % 25 == 0:
        print(0)
    
    else:
        s = str(i)
        m1, m2, m3 = 0, 0, 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') :
                m1 = 1
            else:
                m1 = 2
                
            
        # van benne 5-ös és 0
        if '0' in s and '5' in s:
            if s[-1] == '5' and s[-2]=='0':
                m2 = 1
            else:
                m2 = 2
                
            
        # ha van benne 2 nulla
        if s.count('0')>1:
            if s[-1]=='0' or s[-2]=='0':
                m3 = 1
            else:
                m3 = 2
                
            
        if m1+m2+m3 == 0:
            print(-1)
        else:
            x = [m1, m2, m3]
            while 0 in x:
                x.remove(0)
            print(min(x))
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted17ms3044 KiB
subtask20/21
2Wrong answer134ms4740 KiB
subtask30/23
3Wrong answer298ms7760 KiB
4Wrong answer301ms7620 KiB
5Wrong answer316ms7688 KiB
6Wrong answer303ms7664 KiB
7Wrong answer300ms7660 KiB
8Wrong answer361ms7664 KiB
9Wrong answer308ms7660 KiB
10Wrong answer314ms7620 KiB
11Wrong answer305ms7620 KiB
12Wrong answer308ms7620 KiB
13Wrong answer335ms7792 KiB
14Wrong answer312ms7548 KiB
15Wrong answer301ms7620 KiB
16Wrong answer368ms7620 KiB
17Wrong answer319ms7620 KiB
18Wrong answer321ms7752 KiB
19Wrong answer340ms7652 KiB
20Wrong answer335ms7624 KiB
21Wrong answer317ms7624 KiB
22Wrong answer307ms7904 KiB
23Wrong answer308ms7624 KiB
subtask40/41
24Accepted18ms3044 KiB
25Accepted18ms3192 KiB
26Accepted17ms3044 KiB
27Accepted18ms3180 KiB
28Accepted18ms2964 KiB
29Accepted18ms3216 KiB
30Accepted17ms3044 KiB
31Accepted17ms3044 KiB
32Accepted18ms3044 KiB
33Wrong answer18ms3044 KiB
34Accepted17ms3068 KiB
35Accepted17ms3108 KiB
36Accepted21ms3164 KiB
37Accepted41ms3208 KiB
38Accepted17ms2976 KiB
39Accepted17ms3192 KiB
40Accepted17ms3092 KiB
41Accepted18ms3012 KiB
42Accepted20ms3048 KiB
43Accepted20ms3436 KiB
44Accepted20ms3176 KiB
45Accepted21ms3076 KiB
46Wrong answer18ms3044 KiB
47Wrong answer20ms3320 KiB
subtask50/15
48Wrong answer59ms3620 KiB
49Runtime error18ms3336 KiB
50Wrong answer372ms7428 KiB
51Runtime error17ms3044 KiB
52Wrong answer108ms4724 KiB
53Runtime error17ms3044 KiB
54Accepted57ms3704 KiB
55Accepted56ms4196 KiB
56Accepted275ms7568 KiB
57Runtime error18ms3320 KiB
58Runtime error18ms3300 KiB
59Runtime error17ms3300 KiB
60Accepted57ms3684 KiB
61Accepted57ms3684 KiB
62Accepted56ms3704 KiB
63Accepted57ms3652 KiB
64Accepted268ms7624 KiB
65Accepted266ms7624 KiB
66Accepted273ms7496 KiB