82832024-01-14 09:30:59MagyarKendeSZLGVirágos rét (50 pont)cpp17Wrong answer 42/509ms4120 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; exit(0);
    }
    
    for (int i = 0; i < M - K + 1; i++) {
        result += M- i - K + 1;
    }
    cout << result;
}
SubtaskSumTestVerdictTimeMemory
base42/50
1Accepted0/03ms2004 KiB
2Accepted0/03ms2156 KiB
3Accepted0/09ms2364 KiB
4Accepted2/23ms2556 KiB
5Accepted2/22ms2644 KiB
6Accepted2/22ms2640 KiB
7Accepted3/32ms2640 KiB
8Accepted3/32ms2636 KiB
9Accepted3/33ms2888 KiB
10Accepted2/23ms3084 KiB
11Accepted3/33ms3264 KiB
12Accepted2/23ms3344 KiB
13Accepted3/33ms3348 KiB
14Accepted2/29ms3480 KiB
15Wrong answer0/29ms3688 KiB
16Accepted3/39ms3832 KiB
17Accepted3/38ms3896 KiB
18Wrong answer0/39ms3876 KiB
19Accepted3/39ms3876 KiB
20Accepted3/39ms4004 KiB
21Accepted3/39ms4116 KiB
22Wrong answer0/39ms4120 KiB