119242024-11-19 19:04:51banhelyiVirágos rét (50 pont)cpp17Accepted 50/5017ms540 KiB
#include <iostream>

using namespace std;

int main()
{
    int n;
    int k;
    int szam;
    int ja=0;
    int j;
    cin >> n;
    cin >> k;
    for(int i=0; i < n; i++){
        cin >> j;
        ja += j;
    }
	long int jo=(ja)-(k)+1;
    jo=(jo+1)*(jo)/2;
    cout << ((ja>=k)?jo:0) << "\n";

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/01ms320 KiB
2Accepted0/01ms320 KiB
3Accepted0/017ms320 KiB
4Accepted2/21ms320 KiB
5Accepted2/21ms320 KiB
6Accepted2/21ms320 KiB
7Accepted3/31ms320 KiB
8Accepted3/31ms320 KiB
9Accepted3/31ms320 KiB
10Accepted2/21ms320 KiB
11Accepted3/31ms320 KiB
12Accepted2/22ms512 KiB
13Accepted3/31ms320 KiB
14Accepted2/217ms540 KiB
15Accepted2/217ms500 KiB
16Accepted3/317ms320 KiB
17Accepted3/317ms404 KiB
18Accepted3/317ms500 KiB
19Accepted3/317ms320 KiB
20Accepted3/317ms508 KiB
21Accepted3/317ms404 KiB
22Accepted3/317ms320 KiB