120422024-11-26 12:25:05LordCasinoIISzámjegycserepython3Runtime error 21/100379ms10912 KiB
t = int(input())
k = []
for _ in range(t):
    k.append(input())

for _ in range(t):
    n = k[_]

    if n[-2:] in ['00','25','50','75']:
        print(0)
    elif n[-1] == '0' and (n[:-1].count('0') >= 1 or n[:-1].count('5') >= 1):
        print(1)
    elif n[-1] == '5' and (n[:-1].count('2') >= 1 or n[:-1].count('7') >= 1):
        print(1)
    elif (n[-2] == '2' and n.count('5') >= 1) or (n[-2] == '0' and n.count('0') >= 2) or (n[-2] == '5' and n.count('0')>=1) or (n[-2] == '7' and n.count('5') >= 1):
        print(1)
    elif n[-2:] in ['52','57','05']:
        print(1)
    elif (n.count('0') >= 2) or (n.count('5') >= 1 and n.count('0') >= 1) or (n.count('2') >= 1 and n.count('5') >= 1) or (n.count('7') >= 1 and n.count('5') >= 1) or (n.count('5')>=1 and n.count('7') >=1):
        print(2)
    else:
        print(-1)
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted16ms3128 KiB
subtask221/21
2Accepted109ms5828 KiB
subtask30/23
3Runtime error347ms10688 KiB
4Accepted349ms10696 KiB
5Accepted337ms10716 KiB
6Accepted345ms10692 KiB
7Accepted351ms10696 KiB
8Accepted333ms10856 KiB
9Accepted344ms10696 KiB
10Accepted342ms10828 KiB
11Accepted342ms10692 KiB
12Accepted345ms10692 KiB
13Accepted307ms10848 KiB
14Accepted338ms10912 KiB
15Accepted344ms10696 KiB
16Accepted314ms10696 KiB
17Accepted340ms10696 KiB
18Accepted340ms10700 KiB
19Accepted305ms10700 KiB
20Accepted305ms10852 KiB
21Accepted361ms10884 KiB
22Accepted351ms10696 KiB
23Accepted344ms10700 KiB
subtask40/41
24Accepted16ms3128 KiB
25Accepted17ms3128 KiB
26Accepted17ms3128 KiB
27Accepted16ms3128 KiB
28Accepted16ms2996 KiB
29Accepted14ms3188 KiB
30Accepted17ms3064 KiB
31Accepted16ms3000 KiB
32Accepted16ms3128 KiB
33Accepted16ms3344 KiB
34Accepted16ms3128 KiB
35Accepted17ms3128 KiB
36Accepted19ms3344 KiB
37Runtime error26ms3292 KiB
38Accepted17ms3100 KiB
39Accepted17ms3236 KiB
40Accepted16ms3128 KiB
41Accepted16ms3144 KiB
42Accepted19ms3172 KiB
43Accepted19ms3224 KiB
44Accepted19ms3376 KiB
45Accepted18ms3252 KiB
46Accepted16ms3132 KiB
47Accepted18ms3368 KiB
subtask50/15
48Accepted24ms4400 KiB
49Accepted20ms4400 KiB
50Accepted321ms10712 KiB
51Accepted20ms4244 KiB
52Runtime error39ms5284 KiB
53Accepted20ms4160 KiB
54Accepted26ms4376 KiB
55Accepted59ms5020 KiB
56Accepted372ms10676 KiB
57Accepted17ms4408 KiB
58Accepted18ms4364 KiB
59Accepted24ms4408 KiB
60Accepted23ms4408 KiB
61Accepted23ms4408 KiB
62Accepted30ms4408 KiB
63Accepted25ms4248 KiB
64Accepted379ms10704 KiB
65Accepted349ms10700 KiB
66Accepted352ms10704 KiB