85672024-01-22 07:20:10bzsofiaVirágos rét (50 pont)cpp14Elfogadva 50/5010ms4176 KiB
// Proba.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <fstream>

#define ll long long

using namespace std;

ifstream fin("virag.in");
ofstream fout("virag.out");

ll n, k, s, i, db;
bool a;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin >> n >> k;

    for (i = 1; i <= n; ++i)
    {
        cin >> a;
        if (a)
        {
            ++db;
        }
    }

    for (i = 1; i <= db - k + 1; ++i)
    {
        s += i;
    }

    cout << s;

    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/03ms1768 KiB
2Elfogadva0/03ms1936 KiB
3Elfogadva0/010ms2148 KiB
4Elfogadva2/23ms2236 KiB
5Elfogadva2/23ms2480 KiB
6Elfogadva2/23ms2716 KiB
7Elfogadva3/33ms2812 KiB
8Elfogadva3/33ms3172 KiB
9Elfogadva3/33ms3264 KiB
10Elfogadva2/23ms3496 KiB
11Elfogadva3/33ms3864 KiB
12Elfogadva2/23ms3740 KiB
13Elfogadva3/33ms3808 KiB
14Elfogadva2/29ms4040 KiB
15Elfogadva2/29ms4084 KiB
16Elfogadva3/310ms4088 KiB
17Elfogadva3/310ms4088 KiB
18Elfogadva3/310ms4176 KiB
19Elfogadva3/310ms4092 KiB
20Elfogadva3/310ms4092 KiB
21Elfogadva3/310ms4084 KiB
22Elfogadva3/310ms4088 KiB