118872024-11-15 15:31:09matthiasSzámjegycserepython3Accepted 100/100574ms3560 KiB
T = int(input())
for i in range(T):
    N = input()

    v = -1
    nullas = N.count('0')
    if len(N) >= 2:
        if N[-2:] in ['00','25', '50', '75']:
            v = 0
        elif N[-2:] in ['52', '05', '57']:
            v = 1
        elif N[-1] == '5' and (('2' in N) or ('7' in N)):
            v = 1
        elif N[-1] == '0' and (('5' in N) or nullas >= 2):
            v = 1
        elif N[-2] in '72' and '5' in N:
            v = 1
        elif N[-2] == '5' and '0' in N:
            v = 1
        elif N[-2] == '0' and nullas >= 2:
            v = 1
        elif ('5' in N) and (('2' in N) or ('7' in N) or ('0' in N)):
            v = 2
        elif  nullas >= 2:
            v = 2
    print(v)

SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted14ms3128 KiB
subtask221/21
2Accepted175ms3128 KiB
subtask323/23
3Accepted514ms3384 KiB
4Accepted532ms3384 KiB
5Accepted507ms3236 KiB
6Accepted522ms3476 KiB
7Accepted524ms3444 KiB
8Accepted574ms3208 KiB
9Accepted532ms3440 KiB
10Accepted532ms3448 KiB
11Accepted515ms3436 KiB
12Accepted508ms3384 KiB
13Accepted517ms3248 KiB
14Accepted512ms3444 KiB
15Accepted519ms3384 KiB
16Accepted526ms3384 KiB
17Accepted526ms3436 KiB
18Accepted524ms3384 KiB
19Accepted515ms3272 KiB
20Accepted521ms3384 KiB
21Accepted519ms3384 KiB
22Accepted527ms3264 KiB
23Accepted493ms3384 KiB
subtask441/41
24Accepted16ms3064 KiB
25Accepted16ms3124 KiB
26Accepted16ms3128 KiB
27Accepted16ms3124 KiB
28Accepted16ms3260 KiB
29Accepted16ms3052 KiB
30Accepted16ms3180 KiB
31Accepted14ms2980 KiB
32Accepted14ms3040 KiB
33Accepted16ms2992 KiB
34Accepted16ms3184 KiB
35Accepted17ms3312 KiB
36Accepted21ms3180 KiB
37Accepted57ms3172 KiB
38Accepted17ms2984 KiB
39Accepted16ms3184 KiB
40Accepted17ms3128 KiB
41Accepted17ms3108 KiB
42Accepted19ms2996 KiB
43Accepted20ms3176 KiB
44Accepted21ms3092 KiB
45Accepted20ms3132 KiB
46Accepted16ms3012 KiB
47Accepted20ms3128 KiB
subtask515/15
48Accepted25ms3040 KiB
49Accepted19ms3560 KiB
50Accepted541ms3428 KiB
51Accepted19ms3196 KiB
52Accepted119ms3128 KiB
53Accepted17ms3132 KiB
54Accepted23ms3068 KiB
55Accepted68ms3192 KiB
56Accepted529ms3456 KiB
57Accepted19ms3520 KiB
58Accepted17ms3560 KiB
59Accepted17ms3560 KiB
60Accepted21ms3124 KiB
61Accepted23ms3188 KiB
62Accepted23ms3132 KiB
63Accepted21ms3128 KiB
64Accepted523ms3384 KiB
65Accepted518ms3324 KiB
66Accepted497ms3384 KiB