199952025-12-30 22:07:18szabelrVirágos rét (50 pont)cpp17Elfogadva 50/5017ms552 KiB
// viragos ret.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>

using namespace std;

int main()
{
    long long n, k, egyesek = 0, ossz = 0, most = 0;
    
    cin >> n >> k;
    for (int i = 1; i <= n; i++) {
        int x;
        cin >> x;
        if (x == 1)
            egyesek++;
    }
    if (k > egyesek)
        cout << "0";
    else {
        cout << ((egyesek - k + 2) * (egyesek - k+1)) / 2;
        /*while (egyesek - k + 1 - most > 0) {
            ossz = ossz + (egyesek - k + 1 - most);
            most++;
        }
        cout << ossz;*/
    }
    //cout<<ossz;
    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
RészfeladatÖsszpontTesztVerdiktIdőMemória
base50/50
1Elfogadva0/01ms316 KiB
2Elfogadva0/01ms512 KiB
3Elfogadva0/017ms316 KiB
4Elfogadva2/21ms316 KiB
5Elfogadva2/21ms316 KiB
6Elfogadva2/21ms404 KiB
7Elfogadva3/31ms316 KiB
8Elfogadva3/31ms316 KiB
9Elfogadva3/31ms500 KiB
10Elfogadva2/21ms316 KiB
11Elfogadva3/31ms316 KiB
12Elfogadva2/21ms500 KiB
13Elfogadva3/31ms552 KiB
14Elfogadva2/216ms316 KiB
15Elfogadva2/217ms396 KiB
16Elfogadva3/317ms316 KiB
17Elfogadva3/317ms400 KiB
18Elfogadva3/317ms396 KiB
19Elfogadva3/317ms396 KiB
20Elfogadva3/317ms400 KiB
21Elfogadva3/317ms400 KiB
22Elfogadva3/317ms508 KiB