111032024-07-06 23:32:49probaSzámjegycserepython3Runtime error 0/10019ms3324 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 = 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':
                m1 = 1
            else:
                if m1 == 0:
                    m1 = 2
                
            
        # ha van benne 2 nulla
        if s.count('0')>1:
            if s[-1]=='0' or s[-2]=='0':
                m1 = 1
            else:
                if m1 = 0:
                    m1 = 2
                
            
        if m1 == 0:
            print(-1)
        else:
            print(m1)
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Runtime error17ms3044 KiB
subtask20/21
2Runtime error18ms3048 KiB
subtask30/23
3Runtime error17ms3048 KiB
4Runtime error18ms3184 KiB
5Runtime error18ms3216 KiB
6Runtime error18ms3112 KiB
7Runtime error18ms3128 KiB
8Runtime error17ms3192 KiB
9Runtime error18ms3080 KiB
10Runtime error17ms3176 KiB
11Runtime error17ms3192 KiB
12Runtime error17ms3044 KiB
13Runtime error18ms3124 KiB
14Runtime error18ms3172 KiB
15Runtime error17ms2972 KiB
16Runtime error17ms3044 KiB
17Runtime error18ms3132 KiB
18Runtime error17ms3324 KiB
19Runtime error17ms3044 KiB
20Runtime error17ms3124 KiB
21Runtime error19ms3200 KiB
22Runtime error17ms3192 KiB
23Runtime error17ms3044 KiB
subtask40/41
24Runtime error18ms3108 KiB
25Runtime error17ms3044 KiB
26Runtime error18ms3132 KiB
27Runtime error17ms3216 KiB
28Runtime error18ms3044 KiB
29Runtime error18ms3312 KiB
30Runtime error17ms3088 KiB
31Runtime error17ms3092 KiB
32Runtime error17ms3044 KiB
33Runtime error18ms3044 KiB
34Runtime error17ms3156 KiB
35Runtime error17ms3092 KiB
36Runtime error17ms3172 KiB
37Runtime error17ms2976 KiB
38Runtime error18ms3044 KiB
39Runtime error18ms3308 KiB
40Runtime error17ms3064 KiB
41Runtime error18ms3044 KiB
42Runtime error17ms3044 KiB
43Runtime error17ms3192 KiB
44Runtime error17ms3044 KiB
45Runtime error18ms3064 KiB
46Runtime error18ms3048 KiB
47Runtime error17ms3264 KiB
subtask50/15
48Runtime error18ms3044 KiB
49Runtime error17ms3048 KiB
50Runtime error18ms3048 KiB
51Runtime error18ms3116 KiB
52Runtime error17ms3044 KiB
53Runtime error17ms2972 KiB
54Runtime error17ms3172 KiB
55Runtime error17ms3044 KiB
56Runtime error17ms3192 KiB
57Runtime error17ms2992 KiB
58Runtime error17ms3048 KiB
59Runtime error17ms3056 KiB
60Runtime error17ms3044 KiB
61Runtime error17ms3284 KiB
62Runtime error17ms3044 KiB
63Runtime error17ms3036 KiB
64Runtime error17ms3044 KiB
65Runtime error18ms2988 KiB
66Runtime error17ms2916 KiB