136432025-01-08 12:00:15feheristvanVirágos rét (50 pont)cpp17Wrong answer 4/5018ms508 KiB
#include <iostream>
#include <vector>

using namespace std;

int main()
{
    int n, k;
    cin >> n >> k;
    
    int x, egyes = 0; // Initialize egyes to 0
    for(int i = 0; i < n; i++){
        cin >> x;
        if(x == 1){ // Count only the number of 1's
            egyes++;
        }
    }
    
    // If there are not enough 1's to form a group of size k, the result is 0
    if (egyes < k) {
        cout << 0;
        return 0;
    }

    // Calculate the number of ways to choose k 1's from the total number of 1's
    int ossz = 0;
    // The number of ways to choose k 1's from egyes 1's is given by:
    // (egyes - k + 1) * (egyes - k) / 2
    ossz = (egyes - k + 1) * (egyes - k) / 2;

    cout << ossz;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base4/50
1Wrong answer0/01ms316 KiB
2Accepted0/01ms316 KiB
3Wrong answer0/017ms316 KiB
4Wrong answer0/21ms508 KiB
5Accepted2/21ms316 KiB
6Accepted2/21ms316 KiB
7Wrong answer0/31ms508 KiB
8Wrong answer0/31ms320 KiB
9Wrong answer0/31ms316 KiB
10Wrong answer0/21ms316 KiB
11Wrong answer0/31ms372 KiB
12Wrong answer0/21ms316 KiB
13Wrong answer0/31ms316 KiB
14Wrong answer0/217ms396 KiB
15Wrong answer0/217ms396 KiB
16Wrong answer0/318ms400 KiB
17Wrong answer0/317ms396 KiB
18Wrong answer0/318ms396 KiB
19Wrong answer0/317ms400 KiB
20Wrong answer0/317ms316 KiB
21Wrong answer0/317ms508 KiB
22Wrong answer0/317ms396 KiB