82972024-01-14 11:54:40Balki22Virágos rét (50 pont)cpp17Accepted 50/509ms3428 KiB
#include <bits/stdc++.h>

using namespace std;
using ull = unsigned long long;

int main()
{
    ios::sync_with_stdio(false); cin.tie(0);
    ull n, k; cin >> n >> k;

    ull r = 0;
    for (int i = 0; i < n; i++) {
        int a; cin >> a;
        if (a == 1) r++;
    }

    ull sum = 0;
    for (int i = k; i <= r; i++) {
        sum += r - i + 1;
    }

    cout << sum;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1892 KiB
2Accepted0/03ms2084 KiB
3Accepted0/09ms2304 KiB
4Accepted2/23ms2508 KiB
5Accepted2/23ms2716 KiB
6Accepted2/23ms2804 KiB
7Accepted3/32ms2804 KiB
8Accepted3/33ms2960 KiB
9Accepted3/33ms3072 KiB
10Accepted2/23ms2820 KiB
11Accepted3/33ms2820 KiB
12Accepted2/23ms2820 KiB
13Accepted3/33ms2948 KiB
14Accepted2/28ms3048 KiB
15Accepted2/28ms3164 KiB
16Accepted3/39ms3416 KiB
17Accepted3/39ms3264 KiB
18Accepted3/39ms3420 KiB
19Accepted3/39ms3428 KiB
20Accepted3/39ms3280 KiB
21Accepted3/39ms3284 KiB
22Accepted3/38ms3428 KiB