85672024-01-22 07:20:10bzsofiaVirágos rét (50 pont)cpp14Accepted 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
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1768 KiB
2Accepted0/03ms1936 KiB
3Accepted0/010ms2148 KiB
4Accepted2/23ms2236 KiB
5Accepted2/23ms2480 KiB
6Accepted2/23ms2716 KiB
7Accepted3/33ms2812 KiB
8Accepted3/33ms3172 KiB
9Accepted3/33ms3264 KiB
10Accepted2/23ms3496 KiB
11Accepted3/33ms3864 KiB
12Accepted2/23ms3740 KiB
13Accepted3/33ms3808 KiB
14Accepted2/29ms4040 KiB
15Accepted2/29ms4084 KiB
16Accepted3/310ms4088 KiB
17Accepted3/310ms4088 KiB
18Accepted3/310ms4176 KiB
19Accepted3/310ms4092 KiB
20Accepted3/310ms4092 KiB
21Accepted3/310ms4084 KiB
22Accepted3/310ms4088 KiB