82802024-01-14 09:21:09MagyarKendeSZLGVirágos rét (50 pont)cpp17Wrong answer 42/504ms3980 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;
    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/03ms2076 KiB
2Accepted0/03ms2356 KiB
3Accepted0/04ms2348 KiB
4Accepted2/22ms2356 KiB
5Accepted2/23ms2768 KiB
6Accepted2/23ms2576 KiB
7Accepted3/33ms2740 KiB
8Accepted3/33ms2888 KiB
9Accepted3/33ms2896 KiB
10Accepted2/22ms2896 KiB
11Accepted3/33ms3168 KiB
12Accepted2/23ms3264 KiB
13Accepted3/33ms3476 KiB
14Accepted2/24ms3544 KiB
15Wrong answer0/24ms3652 KiB
16Accepted3/34ms3792 KiB
17Accepted3/34ms3684 KiB
18Wrong answer0/34ms3684 KiB
19Accepted3/34ms3688 KiB
20Accepted3/34ms3900 KiB
21Accepted3/34ms3980 KiB
22Wrong answer0/34ms3948 KiB