119672024-11-22 14:54:05redfoxdeltaSzámjegycserepython3Accepted 100/100574ms3680 KiB
#  /|  /|  ~ ┏━━━━━━━━━━━━━━━━━┓
#( °-° )  ~                         Do NOT copy!
#/づづ ~┗━━━━━━━━━━━━━━━━━┛

K = int(input())
for i in range(K):
    N = input()

    s = -1
    phr = N.count('0')
    if len(N) >= 2:
        if N[-2:] in ['00','25', '50', '75']:
            s = 0
        elif N[-2:] in ['52', '05', '57']:
            s = 1
        elif N[-1] == '5' and (('2' in N) or ('7' in N)):
            s = 1
        elif N[-1] == '0' and (('5' in N) or phr >= 2):
            s = 1
        elif N[-2] in '72' and '5' in N:
            s = 1
        elif N[-2] == '5' and '0' in N:
            s = 1
        elif N[-2] == '0' and phr >= 2:
            s = 1
        elif ('5' in N) and (('2' in N) or ('7' in N) or ('0' in N)):
            s = 2
        elif  phr >= 2:
            s = 2
    print(s)
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted16ms3128 KiB
subtask221/21
2Accepted199ms3128 KiB
subtask323/23
3Accepted546ms3384 KiB
4Accepted522ms3448 KiB
5Accepted518ms3384 KiB
6Accepted526ms3452 KiB
7Accepted524ms3384 KiB
8Accepted540ms3384 KiB
9Accepted521ms3384 KiB
10Accepted517ms3384 KiB
11Accepted509ms3264 KiB
12Accepted509ms3228 KiB
13Accepted518ms3436 KiB
14Accepted574ms3384 KiB
15Accepted522ms3340 KiB
16Accepted523ms3384 KiB
17Accepted521ms3384 KiB
18Accepted513ms3384 KiB
19Accepted560ms3384 KiB
20Accepted532ms3384 KiB
21Accepted526ms3384 KiB
22Accepted528ms3680 KiB
23Accepted500ms3384 KiB
subtask441/41
24Accepted17ms3128 KiB
25Accepted16ms3320 KiB
26Accepted16ms3128 KiB
27Accepted16ms3008 KiB
28Accepted16ms3320 KiB
29Accepted16ms3148 KiB
30Accepted16ms3384 KiB
31Accepted16ms3132 KiB
32Accepted17ms3060 KiB
33Accepted16ms3128 KiB
34Accepted16ms3016 KiB
35Accepted17ms3208 KiB
36Accepted21ms3096 KiB
37Accepted54ms3020 KiB
38Accepted17ms3072 KiB
39Accepted16ms3300 KiB
40Accepted16ms3144 KiB
41Accepted17ms3128 KiB
42Accepted20ms3092 KiB
43Accepted20ms3180 KiB
44Accepted19ms3012 KiB
45Accepted20ms3172 KiB
46Accepted17ms3096 KiB
47Accepted19ms3184 KiB
subtask515/15
48Accepted25ms3128 KiB
49Accepted19ms3468 KiB
50Accepted504ms3280 KiB
51Accepted19ms3036 KiB
52Accepted119ms3260 KiB
53Accepted17ms3128 KiB
54Accepted21ms3128 KiB
55Accepted68ms3128 KiB
56Accepted532ms3400 KiB
57Accepted18ms3564 KiB
58Accepted17ms3428 KiB
59Accepted17ms3560 KiB
60Accepted23ms3012 KiB
61Accepted21ms3220 KiB
62Accepted24ms3128 KiB
63Accepted21ms3056 KiB
64Accepted521ms3272 KiB
65Accepted532ms3388 KiB
66Accepted570ms3384 KiB