121982024-12-08 15:03:11SRobÚthasználati díj (75 pont)cpp17Accepted 75/7518ms512 KiB
// uthasznalat.cpp : Defines the entry point for the console application.
//

//#include "stdafx.h"
#include <iostream>

using namespace std;


int main()
{
	int varosDb, K;
	cin >> varosDb >> K;
	int seged;
	int egyDb = 0;
	for (int i = 0; i < varosDb; i++)
	{
		cin >> seged;
		if (seged== 1)
		{
			egyDb++;
		}
	}

	int megoldas = 0;
	for (int i = 1; i <= egyDb; i++)
	{
		if (egyDb-i  >= K-1)
		{
			megoldas+=K-1;
			//cout << K-1;
		}
		else
		{
			megoldas+= egyDb-i;
			//cout << egyDb-i;
		}
	}
	
	
	cout << megoldas;	
}

SubtaskSumTestVerdictTimeMemory
base75/75
1Accepted0/01ms320 KiB
2Accepted0/01ms512 KiB
3Accepted0/018ms320 KiB
4Accepted5/51ms320 KiB
5Accepted5/51ms320 KiB
6Accepted5/51ms320 KiB
7Accepted5/51ms320 KiB
8Accepted5/51ms320 KiB
9Accepted5/51ms320 KiB
10Accepted5/51ms320 KiB
11Accepted5/51ms320 KiB
12Accepted5/51ms320 KiB
13Accepted5/51ms380 KiB
14Accepted5/518ms408 KiB
15Accepted5/518ms400 KiB
16Accepted5/517ms400 KiB
17Accepted5/517ms404 KiB
18Accepted5/517ms320 KiB