83832024-01-15 11:17:18antiVirágos rét (50 pont)cpp14Accepted 50/5019ms3500 KiB
#include <iostream>

using namespace std;

int main()
{
    long long int n, k;
    cin >> n >> k;
    long long int hany = 0;
    for(long long int i=0; i<n; i++){
        int h;
        cin >> h;
        hany+=h;
    }
    if(hany>=k){
        cout << (hany-k+1)*(hany-k+2)/2;
    }
    else{
        cout << 0;
    }
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1748 KiB
2Accepted0/03ms1912 KiB
3Accepted0/019ms2124 KiB
4Accepted2/22ms2208 KiB
5Accepted2/23ms2340 KiB
6Accepted2/22ms2416 KiB
7Accepted3/33ms2544 KiB
8Accepted3/33ms2800 KiB
9Accepted3/32ms2844 KiB
10Accepted2/23ms2996 KiB
11Accepted3/33ms2920 KiB
12Accepted2/23ms3052 KiB
13Accepted3/33ms3044 KiB
14Accepted2/218ms3048 KiB
15Accepted2/218ms3076 KiB
16Accepted3/319ms3056 KiB
17Accepted3/319ms3192 KiB
18Accepted3/319ms3184 KiB
19Accepted3/319ms3132 KiB
20Accepted3/319ms3256 KiB
21Accepted3/319ms3500 KiB
22Accepted3/319ms3384 KiB