144322025-01-10 18:43:25JoKoBoVirágos rét (50 pont)cpp17Accepted 50/5018ms512 KiB
#include <bits/stdc++.h>
using namespace std;

int main(){
    long long ret = 0;
    int k = 0;
    int viragos = 0;
    long long result = 0; //int-en nem mukodott...
    cin >> ret >> k;
    int beker = 0;
    for(int i = 0; i < ret; i++) {
        cin >> beker;
        viragos += beker;
    }
    if(viragos < k) {
        cout << 0;
    } else {
    for(int i = 1; i <= viragos; i++) {
        result += max(0, viragos - k - i + 2);
    }
    cout << result;
    //Gondolom, ez mar jo...
    }
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/01ms316 KiB
2Accepted0/01ms316 KiB
3Accepted0/017ms316 KiB
4Accepted2/21ms316 KiB
5Accepted2/21ms316 KiB
6Accepted2/21ms500 KiB
7Accepted3/31ms316 KiB
8Accepted3/31ms316 KiB
9Accepted3/31ms316 KiB
10Accepted2/21ms372 KiB
11Accepted3/31ms512 KiB
12Accepted2/21ms316 KiB
13Accepted3/31ms316 KiB
14Accepted2/217ms396 KiB
15Accepted2/217ms396 KiB
16Accepted3/317ms400 KiB
17Accepted3/317ms404 KiB
18Accepted3/318ms316 KiB
19Accepted3/317ms400 KiB
20Accepted3/317ms508 KiB
21Accepted3/318ms396 KiB
22Accepted3/317ms508 KiB