119662024-11-22 14:52:54AdamSzámjegycserepython3Accepted 100/100564ms3664 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
1Accepted16ms3064 KiB
subtask221/21
2Accepted175ms3128 KiB
subtask323/23
3Accepted518ms3388 KiB
4Accepted522ms3440 KiB
5Accepted564ms3384 KiB
6Accepted526ms3372 KiB
7Accepted515ms3452 KiB
8Accepted522ms3384 KiB
9Accepted518ms3368 KiB
10Accepted518ms3384 KiB
11Accepted526ms3384 KiB
12Accepted528ms3404 KiB
13Accepted509ms3440 KiB
14Accepted523ms3360 KiB
15Accepted504ms3432 KiB
16Accepted535ms3408 KiB
17Accepted528ms3320 KiB
18Accepted526ms3384 KiB
19Accepted535ms3384 KiB
20Accepted505ms3208 KiB
21Accepted514ms3428 KiB
22Accepted536ms3324 KiB
23Accepted500ms3464 KiB
subtask441/41
24Accepted17ms3128 KiB
25Accepted16ms3120 KiB
26Accepted16ms3320 KiB
27Accepted14ms3128 KiB
28Accepted16ms3124 KiB
29Accepted17ms3116 KiB
30Accepted16ms3128 KiB
31Accepted16ms3136 KiB
32Accepted14ms3180 KiB
33Accepted16ms3184 KiB
34Accepted16ms2964 KiB
35Accepted17ms2960 KiB
36Accepted20ms3180 KiB
37Accepted56ms3232 KiB
38Accepted16ms3128 KiB
39Accepted17ms3088 KiB
40Accepted16ms3320 KiB
41Accepted16ms3128 KiB
42Accepted20ms3180 KiB
43Accepted20ms3128 KiB
44Accepted20ms3188 KiB
45Accepted19ms3188 KiB
46Accepted17ms3184 KiB
47Accepted19ms3208 KiB
subtask515/15
48Accepted25ms3128 KiB
49Accepted19ms3664 KiB
50Accepted523ms3268 KiB
51Accepted21ms3200 KiB
52Accepted118ms3320 KiB
53Accepted17ms3228 KiB
54Accepted21ms3128 KiB
55Accepted68ms3012 KiB
56Accepted518ms3400 KiB
57Accepted18ms3560 KiB
58Accepted17ms3560 KiB
59Accepted17ms3660 KiB
60Accepted23ms3192 KiB
61Accepted21ms3196 KiB
62Accepted24ms3128 KiB
63Accepted21ms3128 KiB
64Accepted533ms3460 KiB
65Accepted528ms3444 KiB
66Accepted492ms3384 KiB