85532024-01-21 20:57:57qertendVirágos rét (50 pont)cpp17Wrong answer 42/5019ms3548 KiB
#include <iostream>
using namespace std;

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

    int szabadRetek = 1;
    int ret;
    for (int i = 0; i < retekSzama; i++) {
        cin >> ret;
        if (ret) szabadRetek++;
    }
    int N = szabadRetek-K;
    if (szabadRetek >= K) cout << (int) (N)*(N+1)/2;
    else if (szabadRetek == K) cout << 1;
    else cout << 0;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base42/50
1Accepted0/03ms1876 KiB
2Accepted0/03ms2068 KiB
3Accepted0/019ms2280 KiB
4Accepted2/23ms2488 KiB
5Accepted2/23ms2576 KiB
6Accepted2/23ms2700 KiB
7Accepted3/33ms2944 KiB
8Accepted3/33ms3084 KiB
9Accepted3/33ms3036 KiB
10Accepted2/23ms3136 KiB
11Accepted3/33ms3196 KiB
12Accepted2/23ms3328 KiB
13Accepted3/33ms3536 KiB
14Accepted2/217ms3424 KiB
15Wrong answer0/217ms3424 KiB
16Accepted3/319ms3424 KiB
17Accepted3/318ms3452 KiB
18Wrong answer0/319ms3420 KiB
19Accepted3/319ms3548 KiB
20Accepted3/318ms3424 KiB
21Accepted3/319ms3424 KiB
22Wrong answer0/318ms3424 KiB