85512024-01-21 20:47:12qertendVirágos rét (50 pont)cpp17Wrong answer 42/5020ms4300 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;
        if (ret) szabadRetek++;
    }
    int N = szabadRetek-K+1;
    if (szabadRetek >= K) cout << (int) (N)*(N+1)/2;
    else cout << 0;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base42/50
1Accepted0/03ms1880 KiB
2Accepted0/03ms2116 KiB
3Accepted0/019ms2356 KiB
4Accepted2/23ms2540 KiB
5Accepted2/23ms2748 KiB
6Accepted2/23ms2832 KiB
7Accepted3/33ms2916 KiB
8Accepted3/33ms3180 KiB
9Accepted3/33ms3060 KiB
10Accepted2/23ms3192 KiB
11Accepted3/33ms3252 KiB
12Accepted2/23ms3656 KiB
13Accepted3/33ms3660 KiB
14Accepted2/218ms3892 KiB
15Wrong answer0/218ms3960 KiB
16Accepted3/319ms3976 KiB
17Accepted3/318ms4096 KiB
18Wrong answer0/319ms4064 KiB
19Accepted3/319ms4184 KiB
20Accepted3/319ms4180 KiB
21Accepted3/320ms4176 KiB
22Wrong answer0/319ms4300 KiB