83362024-01-14 18:28:21eokorVirágos rét (50 pont)cpp17Accepted 50/5019ms3884 KiB
#include <iostream>

using namespace std;

int main()
{
    long long int n,k,db=0;
    cin>>n>>k;
    long long int x;
    for(long long int i=1;i<=n;i++)
    {
        cin>>x;
        db+=x;
    }
    if(db>=k)
        cout<<(db-k+1)*(db-k+2)/2;
    else cout<<0;

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1744 KiB
2Accepted0/03ms2148 KiB
3Accepted0/019ms2216 KiB
4Accepted2/23ms2452 KiB
5Accepted2/23ms2676 KiB
6Accepted2/23ms3036 KiB
7Accepted3/33ms3004 KiB
8Accepted3/33ms3048 KiB
9Accepted3/33ms3244 KiB
10Accepted2/23ms3296 KiB
11Accepted3/33ms3428 KiB
12Accepted2/23ms3420 KiB
13Accepted3/33ms3424 KiB
14Accepted2/218ms3428 KiB
15Accepted2/218ms3428 KiB
16Accepted3/319ms3448 KiB
17Accepted3/318ms3420 KiB
18Accepted3/319ms3424 KiB
19Accepted3/319ms3552 KiB
20Accepted3/319ms3636 KiB
21Accepted3/319ms3760 KiB
22Accepted3/319ms3884 KiB