103922024-04-01 18:50:51MagyarKendeSZLGÚthasználati díj (75 pont)cpp17Accepted 75/7510ms4016 KiB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
    int N, K, db = 0;
    cin >> N >> K;
    while (N--) {
        char c;
        cin >> c;
        db += c == '1';
    }
    int curr = 2;
    ll result = 0;
    while (curr <= db && curr <= K) {
        result += db - curr + 1;
        curr++;
    }
    cout << result;
}
SubtaskSumTestVerdictTimeMemory
base75/75
1Accepted0/03ms1872 KiB
2Accepted0/03ms2124 KiB
3Accepted0/09ms2176 KiB
4Accepted5/53ms2532 KiB
5Accepted5/53ms2688 KiB
6Accepted5/53ms2772 KiB
7Accepted5/53ms2932 KiB
8Accepted5/53ms3200 KiB
9Accepted5/53ms3180 KiB
10Accepted5/53ms3304 KiB
11Accepted5/53ms3500 KiB
12Accepted5/53ms3508 KiB
13Accepted5/53ms3696 KiB
14Accepted5/59ms3708 KiB
15Accepted5/59ms3768 KiB
16Accepted5/59ms4016 KiB
17Accepted5/510ms4016 KiB
18Accepted5/59ms3984 KiB