120412024-11-26 12:23:36gezu11Számjegycserepython3Accepted 100/100542ms3668 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
1Accepted17ms3132 KiB
subtask221/21
2Accepted170ms3204 KiB
subtask323/23
3Accepted532ms3384 KiB
4Accepted536ms3484 KiB
5Accepted515ms3384 KiB
6Accepted531ms3384 KiB
7Accepted523ms3260 KiB
8Accepted518ms3460 KiB
9Accepted526ms3452 KiB
10Accepted527ms3376 KiB
11Accepted535ms3372 KiB
12Accepted523ms3288 KiB
13Accepted528ms3384 KiB
14Accepted526ms3456 KiB
15Accepted523ms3308 KiB
16Accepted517ms3424 KiB
17Accepted526ms3444 KiB
18Accepted522ms3392 KiB
19Accepted510ms3384 KiB
20Accepted514ms3384 KiB
21Accepted515ms3456 KiB
22Accepted515ms3460 KiB
23Accepted493ms3384 KiB
subtask441/41
24Accepted17ms3128 KiB
25Accepted16ms3148 KiB
26Accepted16ms3128 KiB
27Accepted16ms3128 KiB
28Accepted17ms3212 KiB
29Accepted16ms3140 KiB
30Accepted16ms3120 KiB
31Accepted16ms3124 KiB
32Accepted17ms3312 KiB
33Accepted17ms3128 KiB
34Accepted16ms3312 KiB
35Accepted17ms3156 KiB
36Accepted21ms3072 KiB
37Accepted54ms3164 KiB
38Accepted16ms3208 KiB
39Accepted16ms3124 KiB
40Accepted16ms3132 KiB
41Accepted16ms3064 KiB
42Accepted20ms3088 KiB
43Accepted20ms3128 KiB
44Accepted20ms3544 KiB
45Accepted20ms3148 KiB
46Accepted16ms3052 KiB
47Accepted20ms3128 KiB
subtask515/15
48Accepted20ms3216 KiB
49Accepted17ms3668 KiB
50Accepted509ms3452 KiB
51Accepted18ms3128 KiB
52Accepted114ms3128 KiB
53Accepted18ms3128 KiB
54Accepted21ms3144 KiB
55Accepted70ms3132 KiB
56Accepted541ms3524 KiB
57Accepted17ms3560 KiB
58Accepted17ms3560 KiB
59Accepted17ms3612 KiB
60Accepted23ms3224 KiB
61Accepted24ms2976 KiB
62Accepted23ms3128 KiB
63Accepted24ms3128 KiB
64Accepted531ms3468 KiB
65Accepted542ms3384 KiB
66Accepted532ms3384 KiB