87132024-01-26 10:58:04qawsedhztgVirágos rét (50 pont)python3Accepted 50/5057ms16448 KiB
n,m = input().split()
n = int(n)
m = int(m)
b = 0
o = 0
a = input().split()
for i in range(n):
    if a[i] == "1":
        b += 1 
if b-m+2 >= 1:
    for i in range(1,b-m+2):
        o += i
else:
    o = 0
print(o)
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/018ms11192 KiB
2Accepted0/017ms11472 KiB
3Accepted0/037ms14380 KiB
4Accepted2/217ms11892 KiB
5Accepted2/217ms12420 KiB
6Accepted2/217ms12284 KiB
7Accepted3/317ms12416 KiB
8Accepted3/317ms12556 KiB
9Accepted3/317ms12796 KiB
10Accepted2/217ms13188 KiB
11Accepted3/317ms12568 KiB
12Accepted2/217ms13068 KiB
13Accepted3/317ms13220 KiB
14Accepted2/241ms15508 KiB
15Accepted2/257ms15200 KiB
16Accepted3/345ms16448 KiB
17Accepted3/339ms15720 KiB
18Accepted3/352ms15864 KiB
19Accepted3/335ms15692 KiB
20Accepted3/345ms16116 KiB
21Accepted3/343ms16184 KiB
22Accepted3/357ms15956 KiB