83322024-01-14 18:24:24asdasd123Virágos rét (50 pont)cpp17Wrong answer 42/509ms3240 KiB
#include <bits/stdc++.h>

using ll = long long;

using namespace std;

int main()
{
    ios::sync_with_stdio(0); cin.tie(0);
    int n, k;
    cin >> n >> k;
    int cnt = 0;
    for (int i = 0; i < n; i++)
    {
        ll x;
        cin >> x;
        cnt += x;
    }
    if (k > cnt) cout << 0;
    else if (k == cnt) cout << 1;
    else cout << (cnt - k + 1)*(cnt - k + 2)/2;
    
}
SubtaskSumTestVerdictTimeMemory
base42/50
1Accepted0/03ms1900 KiB
2Accepted0/03ms2088 KiB
3Accepted0/09ms2172 KiB
4Accepted2/22ms2164 KiB
5Accepted2/22ms2176 KiB
6Accepted2/23ms2320 KiB
7Accepted3/33ms2528 KiB
8Accepted3/33ms2736 KiB
9Accepted3/32ms2824 KiB
10Accepted2/23ms2972 KiB
11Accepted3/33ms2824 KiB
12Accepted2/23ms2948 KiB
13Accepted3/33ms3060 KiB
14Accepted2/28ms3140 KiB
15Wrong answer0/28ms3136 KiB
16Accepted3/39ms3140 KiB
17Accepted3/39ms3140 KiB
18Wrong answer0/39ms3144 KiB
19Accepted3/39ms3140 KiB
20Accepted3/39ms3148 KiB
21Accepted3/39ms3236 KiB
22Wrong answer0/39ms3240 KiB