122112024-12-09 12:58:40CsongiSzámjegycserepython3Accepted 100/100541ms3660 KiB
t = int(input())

for x in range(t):
    n = input()
    bnull = n.count('0') >= 2

    if len(n) >= 2:
        if n[-2:] in ['00', '75', '50', '25']:
            print("0")
        elif n[-2:] in ['05', '52', '57']:
            print("1")
        elif n[-1] == '5' and (('2' in n) or ('7' in n)):
            print("1")
        elif n[-1] == '0' and (('5' in n) or bnull):
            print("1")
        elif n[-2] in '72' and '5' in n:
            print("1")
        elif n[-2] == '5' and '0' in n:
            print("1")
        elif n[-2] == '0' and bnull:
            print("1")
        elif ('5' in n) and (('2' in n) or ('7' in n) or ('0' in n)):
            print("2")
        elif bnull:
            print("2")
        else:
            print("-1")
    else:
        print("-1")
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted16ms3128 KiB
subtask221/21
2Accepted172ms3092 KiB
subtask323/23
3Accepted508ms3400 KiB
4Accepted523ms3388 KiB
5Accepted509ms3440 KiB
6Accepted509ms3376 KiB
7Accepted513ms3376 KiB
8Accepted509ms3384 KiB
9Accepted510ms3384 KiB
10Accepted541ms3452 KiB
11Accepted508ms3384 KiB
12Accepted518ms3384 KiB
13Accepted505ms3196 KiB
14Accepted507ms3384 KiB
15Accepted504ms3384 KiB
16Accepted523ms3396 KiB
17Accepted512ms3452 KiB
18Accepted509ms3384 KiB
19Accepted512ms3384 KiB
20Accepted493ms3196 KiB
21Accepted515ms3384 KiB
22Accepted504ms3384 KiB
23Accepted493ms3384 KiB
subtask441/41
24Accepted16ms3320 KiB
25Accepted16ms3312 KiB
26Accepted16ms3128 KiB
27Accepted16ms3324 KiB
28Accepted17ms3132 KiB
29Accepted16ms2980 KiB
30Accepted16ms3128 KiB
31Accepted16ms3140 KiB
32Accepted16ms3124 KiB
33Accepted16ms3144 KiB
34Accepted16ms3120 KiB
35Accepted16ms3124 KiB
36Accepted20ms3188 KiB
37Accepted54ms3012 KiB
38Accepted16ms3188 KiB
39Accepted16ms3192 KiB
40Accepted16ms3132 KiB
41Accepted16ms3072 KiB
42Accepted20ms2996 KiB
43Accepted19ms3132 KiB
44Accepted19ms3092 KiB
45Accepted20ms2968 KiB
46Accepted17ms2976 KiB
47Accepted19ms3092 KiB
subtask515/15
48Accepted24ms3128 KiB
49Accepted19ms3488 KiB
50Accepted515ms3428 KiB
51Accepted20ms3128 KiB
52Accepted119ms3216 KiB
53Accepted18ms3124 KiB
54Accepted21ms3064 KiB
55Accepted68ms3212 KiB
56Accepted526ms3384 KiB
57Accepted19ms3560 KiB
58Accepted17ms3552 KiB
59Accepted17ms3660 KiB
60Accepted23ms3128 KiB
61Accepted23ms3132 KiB
62Accepted23ms3196 KiB
63Accepted23ms3200 KiB
64Accepted513ms3276 KiB
65Accepted504ms3296 KiB
66Accepted509ms3384 KiB