111012024-07-06 23:15:16probaSzámjegycserepython3Wrong answer 0/100389ms7760 KiB
# 50, 00, 25, 75
lista = [int(input()) for i in range(int(input()))]
#lista = [157, 1001, 152, 7500, 7005, 200253, 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' or s[-2]=='7' or s[-2]=='2':
                m1 = 1
            else:
                m1 = 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':
                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(max(x))
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted17ms3044 KiB
subtask20/21
2Wrong answer138ms4800 KiB
subtask30/23
3Wrong answer301ms7672 KiB
4Wrong answer314ms7676 KiB
5Wrong answer331ms7620 KiB
6Wrong answer314ms7660 KiB
7Wrong answer307ms7620 KiB
8Wrong answer384ms7684 KiB
9Wrong answer317ms7664 KiB
10Wrong answer323ms7664 KiB
11Wrong answer312ms7620 KiB
12Wrong answer310ms7620 KiB
13Wrong answer349ms7668 KiB
14Wrong answer328ms7704 KiB
15Wrong answer310ms7640 KiB
16Wrong answer382ms7496 KiB
17Wrong answer326ms7588 KiB
18Wrong answer324ms7668 KiB
19Wrong answer354ms7624 KiB
20Wrong answer352ms7684 KiB
21Wrong answer321ms7660 KiB
22Wrong answer312ms7672 KiB
23Wrong answer314ms7624 KiB
subtask40/41
24Accepted18ms3336 KiB
25Accepted17ms3192 KiB
26Accepted17ms3064 KiB
27Accepted18ms3124 KiB
28Accepted18ms3108 KiB
29Accepted18ms3044 KiB
30Accepted17ms3044 KiB
31Accepted17ms3044 KiB
32Accepted18ms3044 KiB
33Wrong answer18ms3088 KiB
34Accepted18ms3240 KiB
35Accepted17ms3172 KiB
36Accepted19ms3184 KiB
37Accepted41ms3428 KiB
38Accepted17ms3048 KiB
39Accepted18ms3044 KiB
40Accepted17ms2948 KiB
41Accepted18ms3192 KiB
42Accepted20ms3172 KiB
43Accepted20ms3112 KiB
44Accepted20ms3312 KiB
45Accepted21ms3136 KiB
46Wrong answer18ms3044 KiB
47Wrong answer21ms3140 KiB
subtask50/15
48Wrong answer61ms3760 KiB
49Runtime error21ms3228 KiB
50Wrong answer389ms7524 KiB
51Runtime error17ms3044 KiB
52Wrong answer112ms4688 KiB
53Runtime error17ms2972 KiB
54Accepted56ms3832 KiB
55Accepted54ms4196 KiB
56Accepted275ms7656 KiB
57Runtime error18ms3452 KiB
58Runtime error17ms3324 KiB
59Runtime error18ms3300 KiB
60Accepted57ms3700 KiB
61Accepted56ms3684 KiB
62Accepted57ms3560 KiB
63Accepted57ms3684 KiB
64Accepted275ms7632 KiB
65Accepted268ms7632 KiB
66Accepted272ms7760 KiB