85542024-01-21 21:03:05qertendVirágos rét (50 pont)cpp17Wrong answer 42/5019ms3632 KiB
#include <iostream>
using namespace std;

int main()
{
    int retekSzama, K;
    cin >> retekSzama;
    cin >> K;

    int szabadRetek = 0;
    int ret;
    for (int i = 0; i < retekSzama; i++) {
        cin >> ret;
        szabadRetek += ret;
    }
    int N = szabadRetek-K+1;
    if (szabadRetek >= K) cout << (int) (N)*(N+1)/2;
    else cout << 0;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base42/50
1Accepted0/03ms1876 KiB
2Accepted0/03ms2120 KiB
3Accepted0/019ms2336 KiB
4Accepted2/23ms2764 KiB
5Accepted2/23ms2720 KiB
6Accepted2/23ms2968 KiB
7Accepted3/33ms3008 KiB
8Accepted3/33ms3124 KiB
9Accepted3/33ms3156 KiB
10Accepted2/23ms3072 KiB
11Accepted3/33ms3076 KiB
12Accepted2/23ms3072 KiB
13Accepted3/33ms3188 KiB
14Accepted2/217ms3088 KiB
15Wrong answer0/218ms3080 KiB
16Accepted3/319ms3076 KiB
17Accepted3/318ms3108 KiB
18Wrong answer0/319ms3180 KiB
19Accepted3/318ms3184 KiB
20Accepted3/319ms3312 KiB
21Accepted3/319ms3552 KiB
22Wrong answer0/318ms3632 KiB