119852024-11-22 15:46:33PeterfalvyZoltanSzámjegycserepython3Accepted 100/100569ms3752 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
1Accepted17ms3128 KiB
subtask221/21
2Accepted171ms3128 KiB
subtask323/23
3Accepted531ms3384 KiB
4Accepted515ms3384 KiB
5Accepted533ms3308 KiB
6Accepted515ms3384 KiB
7Accepted512ms3356 KiB
8Accepted504ms3388 KiB
9Accepted524ms3384 KiB
10Accepted518ms3472 KiB
11Accepted569ms3384 KiB
12Accepted526ms3456 KiB
13Accepted523ms3456 KiB
14Accepted522ms3332 KiB
15Accepted531ms3448 KiB
16Accepted501ms3200 KiB
17Accepted517ms3460 KiB
18Accepted513ms3476 KiB
19Accepted514ms3384 KiB
20Accepted517ms3208 KiB
21Accepted513ms3464 KiB
22Accepted523ms3384 KiB
23Accepted509ms3396 KiB
subtask441/41
24Accepted16ms3320 KiB
25Accepted16ms3312 KiB
26Accepted16ms3128 KiB
27Accepted16ms3124 KiB
28Accepted17ms2972 KiB
29Accepted16ms3208 KiB
30Accepted16ms2976 KiB
31Accepted16ms2976 KiB
32Accepted16ms3128 KiB
33Accepted16ms3148 KiB
34Accepted16ms3216 KiB
35Accepted16ms3128 KiB
36Accepted21ms3364 KiB
37Accepted57ms3232 KiB
38Accepted16ms3364 KiB
39Accepted17ms2988 KiB
40Accepted17ms3128 KiB
41Accepted16ms3172 KiB
42Accepted20ms3192 KiB
43Accepted20ms3076 KiB
44Accepted20ms3128 KiB
45Accepted19ms3200 KiB
46Accepted17ms3204 KiB
47Accepted20ms3204 KiB
subtask515/15
48Accepted23ms3128 KiB
49Accepted17ms3752 KiB
50Accepted523ms3376 KiB
51Accepted18ms3124 KiB
52Accepted115ms3248 KiB
53Accepted17ms3132 KiB
54Accepted23ms3104 KiB
55Accepted79ms3128 KiB
56Accepted537ms3388 KiB
57Accepted17ms3560 KiB
58Accepted17ms3560 KiB
59Accepted17ms3612 KiB
60Accepted23ms3092 KiB
61Accepted23ms2972 KiB
62Accepted23ms3076 KiB
63Accepted23ms3128 KiB
64Accepted531ms3468 KiB
65Accepted526ms3384 KiB
66Accepted523ms3456 KiB