119782024-11-22 15:18:42XetoxinoSzámjegycserepython3Accepted 100/100554ms3752 KiB
N = int(input())
m = 0
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] == '7' and '5' in K:
            m = 1
        elif K[-2] == '5' and '0' in K:
            m = 1
        elif K[-2] == '0' and K.count('0') > 1:
            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
1Accepted14ms3128 KiB
subtask221/21
2Accepted167ms3216 KiB
subtask323/23
3Accepted518ms3380 KiB
4Accepted518ms3376 KiB
5Accepted513ms3376 KiB
6Accepted531ms3488 KiB
7Accepted529ms3384 KiB
8Accepted535ms3384 KiB
9Accepted537ms3464 KiB
10Accepted513ms3384 KiB
11Accepted518ms3420 KiB
12Accepted523ms3444 KiB
13Accepted523ms3456 KiB
14Accepted515ms3332 KiB
15Accepted527ms3352 KiB
16Accepted504ms3384 KiB
17Accepted517ms3384 KiB
18Accepted529ms3460 KiB
19Accepted527ms3384 KiB
20Accepted504ms3384 KiB
21Accepted521ms3460 KiB
22Accepted526ms3464 KiB
23Accepted550ms3384 KiB
subtask441/41
24Accepted17ms3128 KiB
25Accepted17ms3136 KiB
26Accepted16ms3128 KiB
27Accepted16ms3124 KiB
28Accepted16ms3120 KiB
29Accepted16ms3000 KiB
30Accepted16ms3136 KiB
31Accepted16ms3100 KiB
32Accepted16ms3320 KiB
33Accepted16ms3320 KiB
34Accepted16ms3124 KiB
35Accepted17ms3128 KiB
36Accepted20ms2996 KiB
37Accepted54ms3212 KiB
38Accepted16ms3200 KiB
39Accepted16ms3080 KiB
40Accepted17ms3128 KiB
41Accepted17ms3128 KiB
42Accepted20ms3144 KiB
43Accepted20ms3132 KiB
44Accepted20ms3124 KiB
45Accepted20ms3128 KiB
46Accepted16ms3140 KiB
47Accepted19ms3196 KiB
subtask515/15
48Accepted21ms3128 KiB
49Accepted17ms3752 KiB
50Accepted509ms3384 KiB
51Accepted18ms3128 KiB
52Accepted115ms3128 KiB
53Accepted17ms3128 KiB
54Accepted23ms3208 KiB
55Accepted71ms3128 KiB
56Accepted544ms3332 KiB
57Accepted17ms3560 KiB
58Accepted17ms3560 KiB
59Accepted18ms3560 KiB
60Accepted21ms3220 KiB
61Accepted23ms3188 KiB
62Accepted23ms3128 KiB
63Accepted23ms3128 KiB
64Accepted554ms3384 KiB
65Accepted532ms3384 KiB
66Accepted524ms3388 KiB