119702024-11-22 14:55:03tiktakbumbum12Számjegycserepypy3Accepted 100/100531ms30700 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
1Accepted45ms19440 KiB
subtask221/21
2Accepted305ms27116 KiB
subtask323/23
3Accepted531ms28832 KiB
4Accepted495ms29304 KiB
5Accepted430ms27860 KiB
6Accepted504ms30164 KiB
7Accepted492ms29168 KiB
8Accepted462ms27624 KiB
9Accepted503ms29236 KiB
10Accepted449ms28224 KiB
11Accepted495ms29424 KiB
12Accepted503ms29352 KiB
13Accepted430ms27760 KiB
14Accepted442ms28156 KiB
15Accepted499ms30700 KiB
16Accepted490ms27628 KiB
17Accepted458ms28140 KiB
18Accepted453ms28372 KiB
19Accepted407ms24812 KiB
20Accepted423ms25008 KiB
21Accepted437ms27624 KiB
22Accepted490ms29948 KiB
23Accepted470ms29928 KiB
subtask441/41
24Accepted45ms19676 KiB
25Accepted41ms19688 KiB
26Accepted45ms19700 KiB
27Accepted41ms19676 KiB
28Accepted46ms19596 KiB
29Accepted41ms19668 KiB
30Accepted43ms19692 KiB
31Accepted39ms19668 KiB
32Accepted41ms19696 KiB
33Accepted46ms19636 KiB
34Accepted43ms19560 KiB
35Accepted48ms21308 KiB
36Accepted79ms21484 KiB
37Accepted103ms23012 KiB
38Accepted46ms21312 KiB
39Accepted54ms21428 KiB
40Accepted48ms21232 KiB
41Accepted54ms21252 KiB
42Accepted79ms21492 KiB
43Accepted71ms21480 KiB
44Accepted79ms21608 KiB
45Accepted72ms21484 KiB
46Accepted54ms21228 KiB
47Accepted71ms21484 KiB
subtask515/15
48Accepted81ms21468 KiB
49Accepted46ms21768 KiB
50Accepted486ms28876 KiB
51Accepted54ms21620 KiB
52Accepted195ms25068 KiB
53Accepted63ms21348 KiB
54Accepted85ms21488 KiB
55Accepted134ms23788 KiB
56Accepted331ms23544 KiB
57Accepted46ms21744 KiB
58Accepted54ms21704 KiB
59Accepted54ms21808 KiB
60Accepted75ms21556 KiB
61Accepted83ms21484 KiB
62Accepted86ms21484 KiB
63Accepted76ms21676 KiB
64Accepted307ms23424 KiB
65Accepted312ms23824 KiB
66Accepted312ms23532 KiB