200002025-12-30 22:10:38szabelrVirágos rét (50 pont)cpp17Accepted 50/508ms552 KiB
// viragos ret.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    long long n, k, egyesek = 0;
    cin >> n >> k;
    for (int i = 1; i <= n; i++) {
        int x;
        cin >> x;
        egyesek += (x == 1);
    }
    if (k > egyesek)
        cout << "0";
    else {
        cout << ((egyesek - k + 2) * (egyesek - k+1)) / 2;
    }
    return 0;
}


// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu

// Tips for Getting Started: 
//   1. Use the Solution Explorer window to add/manage files
//   2. Use the Team Explorer window to connect to source control
//   3. Use the Output window to see build output and other messages
//   4. Use the Error List window to view errors
//   5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
//   6. In the future, to open this project again, go to File > Open > Project and select the .sln file
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/01ms316 KiB
2Accepted0/01ms500 KiB
3Accepted0/07ms512 KiB
4Accepted2/21ms316 KiB
5Accepted2/21ms316 KiB
6Accepted2/21ms316 KiB
7Accepted3/31ms316 KiB
8Accepted3/31ms316 KiB
9Accepted3/31ms552 KiB
10Accepted2/21ms316 KiB
11Accepted3/31ms316 KiB
12Accepted2/21ms316 KiB
13Accepted3/31ms508 KiB
14Accepted2/27ms424 KiB
15Accepted2/27ms424 KiB
16Accepted3/38ms424 KiB
17Accepted3/38ms500 KiB
18Accepted3/38ms424 KiB
19Accepted3/37ms316 KiB
20Accepted3/37ms316 KiB
21Accepted3/38ms428 KiB
22Accepted3/37ms316 KiB