83352024-01-14 18:28:13asdasd123Virágos rét (50 pont)cpp17Wrong answer 42/509ms3968 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;
    }
    int ossz = cnt - k + 1;
    if (k > cnt) cout << 0;
    else if (k == cnt) cout << 1;
    else cout << (ossz)*(ossz + 1)/2;
    
}
SubtaskSumTestVerdictTimeMemory
base42/50
1Accepted0/03ms1896 KiB
2Accepted0/03ms2116 KiB
3Accepted0/09ms2328 KiB
4Accepted2/23ms2424 KiB
5Accepted2/23ms2944 KiB
6Accepted2/23ms3040 KiB
7Accepted3/33ms3100 KiB
8Accepted3/33ms3156 KiB
9Accepted3/33ms3160 KiB
10Accepted2/23ms3288 KiB
11Accepted3/33ms3300 KiB
12Accepted2/23ms3300 KiB
13Accepted3/33ms3412 KiB
14Accepted2/28ms3596 KiB
15Wrong answer0/28ms3592 KiB
16Accepted3/39ms3684 KiB
17Accepted3/39ms3916 KiB
18Wrong answer0/39ms3688 KiB
19Accepted3/39ms3688 KiB
20Accepted3/39ms3692 KiB
21Accepted3/39ms3880 KiB
22Wrong answer0/39ms3968 KiB