125512024-12-22 20:32:38BucsMateVirágos rét (50 pont)cpp17Accepted 50/5018ms596 KiB
#include <iostream>

using namespace std;

int main()
{
    int N, K;
    cin >> N >> K;
    int nr = 0;
    int temp;
    for(int i = 0; i < N; i++){
        cin >> temp;
        nr += temp;
    }
    if(K > nr){
        cout << 0 << endl;
    }
    else{
        cout << 1LL*(nr-K+2)*(nr-K+1)/2 << endl;
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/01ms320 KiB
2Accepted0/01ms508 KiB
3Accepted0/018ms320 KiB
4Accepted2/21ms320 KiB
5Accepted2/21ms320 KiB
6Accepted2/21ms320 KiB
7Accepted3/31ms320 KiB
8Accepted3/31ms544 KiB
9Accepted3/31ms512 KiB
10Accepted2/21ms320 KiB
11Accepted3/31ms320 KiB
12Accepted2/21ms320 KiB
13Accepted3/31ms320 KiB
14Accepted2/217ms404 KiB
15Accepted2/217ms336 KiB
16Accepted3/317ms508 KiB
17Accepted3/317ms408 KiB
18Accepted3/318ms400 KiB
19Accepted3/318ms404 KiB
20Accepted3/318ms596 KiB
21Accepted3/318ms320 KiB
22Accepted3/317ms404 KiB