121272024-12-03 12:16:45bator1111Számjegycserepython3Accepted 100/100592ms3564 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
2Accepted179ms3128 KiB
subtask323/23
3Accepted513ms3384 KiB
4Accepted529ms3332 KiB
5Accepted524ms3384 KiB
6Accepted521ms3380 KiB
7Accepted523ms3384 KiB
8Accepted573ms3388 KiB
9Accepted526ms3384 KiB
10Accepted523ms3244 KiB
11Accepted510ms3384 KiB
12Accepted509ms3384 KiB
13Accepted528ms3216 KiB
14Accepted522ms3384 KiB
15Accepted592ms3384 KiB
16Accepted513ms3380 KiB
17Accepted529ms3384 KiB
18Accepted531ms3440 KiB
19Accepted512ms3384 KiB
20Accepted508ms3384 KiB
21Accepted519ms3228 KiB
22Accepted527ms3388 KiB
23Accepted503ms3384 KiB
subtask441/41
24Accepted17ms3192 KiB
25Accepted16ms3324 KiB
26Accepted16ms3112 KiB
27Accepted16ms3124 KiB
28Accepted16ms3128 KiB
29Accepted16ms3072 KiB
30Accepted17ms2956 KiB
31Accepted16ms3168 KiB
32Accepted16ms3060 KiB
33Accepted16ms3128 KiB
34Accepted14ms3380 KiB
35Accepted16ms3320 KiB
36Accepted20ms3128 KiB
37Accepted56ms3212 KiB
38Accepted16ms3184 KiB
39Accepted16ms3012 KiB
40Accepted16ms3172 KiB
41Accepted16ms3152 KiB
42Accepted21ms3020 KiB
43Accepted20ms3128 KiB
44Accepted19ms3184 KiB
45Accepted20ms3184 KiB
46Accepted16ms3128 KiB
47Accepted19ms3052 KiB
subtask515/15
48Accepted24ms3128 KiB
49Accepted18ms3452 KiB
50Accepted532ms3352 KiB
51Accepted20ms3044 KiB
52Accepted119ms3016 KiB
53Accepted17ms3020 KiB
54Accepted21ms3196 KiB
55Accepted68ms3108 KiB
56Accepted523ms3504 KiB
57Accepted18ms3564 KiB
58Accepted17ms3560 KiB
59Accepted17ms3560 KiB
60Accepted21ms3072 KiB
61Accepted21ms3092 KiB
62Accepted23ms3052 KiB
63Accepted21ms3212 KiB
64Accepted519ms3504 KiB
65Accepted528ms3384 KiB
66Accepted501ms3460 KiB