82842024-01-14 09:32:35MagyarKendeSZLGVirágos rét (50 pont)cpp17Wrong answer 42/509ms4508 KiB
#include <bits/stdc++.h>
using namespace std;

int N, K, M, result;
int main() {
    cin >> N >> K;

    while (N--) {
        char c;
        cin >> c;
        M += c == '1';
    }

    if (M < K) {
        cout << 0 << '\n';
        exit(0);
    }
    
    for (int i = 0; i < M - K + 1; i++) {
        result += M - i - K + 1;
    }
    
    cout << result;
}
SubtaskSumTestVerdictTimeMemory
base42/50
1Accepted0/03ms1872 KiB
2Accepted0/03ms2124 KiB
3Accepted0/09ms2332 KiB
4Accepted2/23ms2524 KiB
5Accepted2/23ms2924 KiB
6Accepted2/23ms3060 KiB
7Accepted3/33ms3236 KiB
8Accepted3/32ms3284 KiB
9Accepted3/33ms3344 KiB
10Accepted2/23ms3592 KiB
11Accepted3/33ms3768 KiB
12Accepted2/23ms3984 KiB
13Accepted3/33ms4064 KiB
14Accepted2/28ms4256 KiB
15Wrong answer0/29ms4276 KiB
16Accepted3/39ms4388 KiB
17Accepted3/39ms4388 KiB
18Wrong answer0/39ms4508 KiB
19Accepted3/39ms4416 KiB
20Accepted3/39ms4492 KiB
21Accepted3/39ms4372 KiB
22Wrong answer0/39ms4372 KiB