121262024-12-03 12:13:09pandamaciSzámjegycserepython3Accepted 100/100558ms3608 KiB
N = int(input())
m = -1
for i in range(N):
    K = input()
    if len(K) >= 2:
        if K[-2:] in ['00','25','50','75']:
            m = 0
        elif K[-2:] in ['52','05','57']:
            m = 1
        elif K[-1] == '5' and ('2' in K or '7' in K[:-1]):
            m = 1
        elif K[-1] == '0' and ('5' in K or '0' in K[:-1]):
            m = 1
        elif K[-2] == '2' and  ('5' in K ):
            m = 1
        elif K[-2] == '5' and ('0' in K ):
            m = 1
        elif K[-2] == '7' and ('5' in K):
            m = 1
        elif K[-2] == '0' and K.count('0')>= 2:
            m = 1
        elif '2' in K and '5' in K:
            m = 2
        elif '5' in K and '7' in K:
            m = 2
        elif K.count('0') > 1:
            m = 2
        elif '5' in K and '0' in K:
            m = 2
        else:
            m = -1
    else:
        m = -1

    print(m)
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted16ms2996 KiB
subtask221/21
2Accepted172ms3128 KiB
subtask323/23
3Accepted527ms3468 KiB
4Accepted541ms3392 KiB
5Accepted513ms3280 KiB
6Accepted524ms3240 KiB
7Accepted518ms3384 KiB
8Accepted508ms3308 KiB
9Accepted527ms3476 KiB
10Accepted522ms3384 KiB
11Accepted528ms3468 KiB
12Accepted508ms3292 KiB
13Accepted509ms3384 KiB
14Accepted519ms3384 KiB
15Accepted518ms3384 KiB
16Accepted555ms3384 KiB
17Accepted523ms3324 KiB
18Accepted527ms3308 KiB
19Accepted508ms3384 KiB
20Accepted558ms3464 KiB
21Accepted509ms3456 KiB
22Accepted524ms3384 KiB
23Accepted501ms3388 KiB
subtask441/41
24Accepted16ms3128 KiB
25Accepted17ms3124 KiB
26Accepted16ms3128 KiB
27Accepted17ms3128 KiB
28Accepted16ms3200 KiB
29Accepted14ms3196 KiB
30Accepted16ms3040 KiB
31Accepted16ms3036 KiB
32Accepted16ms3172 KiB
33Accepted16ms3080 KiB
34Accepted16ms3112 KiB
35Accepted16ms3128 KiB
36Accepted21ms3320 KiB
37Accepted54ms3128 KiB
38Accepted17ms3144 KiB
39Accepted16ms3128 KiB
40Accepted17ms3128 KiB
41Accepted16ms3064 KiB
42Accepted20ms3200 KiB
43Accepted20ms3140 KiB
44Accepted21ms2992 KiB
45Accepted20ms3152 KiB
46Accepted16ms3120 KiB
47Accepted20ms3200 KiB
subtask515/15
48Accepted21ms3012 KiB
49Accepted17ms3432 KiB
50Accepted517ms3208 KiB
51Accepted17ms3128 KiB
52Accepted115ms3128 KiB
53Accepted17ms3128 KiB
54Accepted21ms3128 KiB
55Accepted70ms3204 KiB
56Accepted555ms3464 KiB
57Accepted17ms3608 KiB
58Accepted17ms3564 KiB
59Accepted17ms3568 KiB
60Accepted23ms3216 KiB
61Accepted21ms3400 KiB
62Accepted23ms3232 KiB
63Accepted21ms3224 KiB
64Accepted531ms3384 KiB
65Accepted531ms3384 KiB
66Accepted518ms3388 KiB