82852024-01-14 09:40:12MagyarKendeSZLGVirágos rét (50 pont)cpp17Accepted 50/509ms3984 KiB
#include <bits/stdc++.h>
#define speed cin.tie(0); ios::sync_with_stdio(0)
using namespace std;
using ll = long long;

int main() {
    speed;

    ll N, K, c, M = 0, result = 0;
    cin >> N >> K;

    while (N--) {
        cin >> c;
        M += c;
    }

    if (M < K) {
        cout << 0;
        exit(0);
    }
    
    for (ll i = 1; i <= M - K + 1; i++) {
        result += M - i - K + 2;
    }

    cout << result;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1900 KiB
2Accepted0/03ms2120 KiB
3Accepted0/09ms2300 KiB
4Accepted2/23ms2392 KiB
5Accepted2/22ms2500 KiB
6Accepted2/23ms2724 KiB
7Accepted3/33ms2968 KiB
8Accepted3/33ms2968 KiB
9Accepted3/32ms3052 KiB
10Accepted2/22ms3156 KiB
11Accepted3/33ms3176 KiB
12Accepted2/23ms3260 KiB
13Accepted3/33ms3268 KiB
14Accepted2/28ms3392 KiB
15Accepted2/28ms3476 KiB
16Accepted3/39ms3580 KiB
17Accepted3/39ms3628 KiB
18Accepted3/39ms3608 KiB
19Accepted3/39ms3480 KiB
20Accepted3/39ms3676 KiB
21Accepted3/39ms3752 KiB
22Accepted3/39ms3984 KiB