185622025-10-26 18:53:32birozsTakaros Sorozat (80 pont)python3Hibás válasz 34/8035ms3336 KiB
N = int(input())
T = input()
i = 0
while i < N and T[i] == "0":
    i += 1
if i < N:
    j = N - 1
    while j >= 0 and T[j] == "1":
        j -= 1
    if j > 0 and i <= j:
        db_0 = T[i:j+1].count("0")
        db_1 = j + 1 - i - db_0
        if db_0 <= db_1:
            print(db_0)
        else:
            print(db_1)
    else:
        print(0)
else:
    print(0)
RészfeladatÖsszpontTesztVerdiktIdőMemória
base34/80
1Hibás válasz0/017ms3308 KiB
2Hibás válasz0/017ms3124 KiB
3Részben helyes2/416ms2868 KiB
4Részben helyes2/414ms3124 KiB
5Részben helyes2/416ms3124 KiB
6Részben helyes2/417ms3140 KiB
7Részben helyes2/416ms3124 KiB
8Részben helyes2/416ms3124 KiB
9Részben helyes2/416ms3100 KiB
10Részben helyes2/414ms3068 KiB
11Részben helyes2/416ms2964 KiB
12Részben helyes2/416ms2916 KiB
13Részben helyes2/434ms3208 KiB
14Részben helyes2/426ms3336 KiB
15Részben helyes2/416ms3124 KiB
16Részben helyes2/416ms3256 KiB
17Részben helyes2/435ms3260 KiB
18Részben helyes2/416ms3084 KiB
19Részben helyes2/417ms3256 KiB
20Hibás válasz0/421ms3124 KiB
21Hibás válasz0/416ms3236 KiB
22Hibás válasz0/417ms3212 KiB