82812024-01-14 09:24:08MagyarKendeSZLGVirágos rét (50 pont)cpp17Wrong answer 42/504ms3688 KiB
#include <bits/stdc++.h>
#define speed cin.tie(0); ios::sync_with_stdio(0)
using namespace std;

int N, K, M, result;
int main() {
    speed;

    cin >> N >> K;

    if (N < K) {
        cout << 0;
        exit(0);
    }

    while (N--) {
        char c; cin >> c;
        M += c == '1';
    }
    
    for (int i = 0; i < M; i++) {
        int curr = M - (i + K) + 1;
        if (curr > 0) result += curr;
    }

    cout << result;
}
SubtaskSumTestVerdictTimeMemory
base42/50
1Accepted0/03ms1892 KiB
2Accepted0/03ms2116 KiB
3Accepted0/04ms2296 KiB
4Accepted2/23ms2504 KiB
5Accepted2/22ms2592 KiB
6Accepted2/23ms2824 KiB
7Accepted3/32ms2804 KiB
8Accepted3/32ms2900 KiB
9Accepted3/32ms2904 KiB
10Accepted2/23ms3032 KiB
11Accepted3/33ms3168 KiB
12Accepted2/23ms3264 KiB
13Accepted3/32ms3228 KiB
14Accepted2/24ms3232 KiB
15Wrong answer0/24ms3256 KiB
16Accepted3/34ms3328 KiB
17Accepted3/34ms3336 KiB
18Wrong answer0/34ms3328 KiB
19Accepted3/34ms3460 KiB
20Accepted3/34ms3544 KiB
21Accepted3/34ms3688 KiB
22Wrong answer0/34ms3668 KiB