84012024-01-15 15:37:01Syntx29Virágos rét (50 pont)cpp17Accepted 50/509ms4220 KiB
#include <iostream>
using namespace std;
using unlong = unsigned long long;

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	unlong n, k; cin >> n >> k;
	int in = 0;
	int res = 0;
	for (int i = 0; i < n; i++)
	{
		cin >> in;
		if (in == 1)
			res++;
	}

	unlong sum = 0;
	for (int i = k; i <= res; i++) {
		sum += res - i + 1;
	}

	cout << sum;
	return 0;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1896 KiB
2Accepted0/03ms2360 KiB
3Accepted0/09ms2440 KiB
4Accepted2/23ms2652 KiB
5Accepted2/23ms2852 KiB
6Accepted2/23ms2876 KiB
7Accepted3/33ms3108 KiB
8Accepted3/33ms3440 KiB
9Accepted3/33ms3424 KiB
10Accepted2/23ms3512 KiB
11Accepted3/33ms3732 KiB
12Accepted2/23ms3816 KiB
13Accepted3/33ms3812 KiB
14Accepted2/28ms3816 KiB
15Accepted2/28ms3944 KiB
16Accepted3/39ms4028 KiB
17Accepted3/39ms4124 KiB
18Accepted3/39ms4088 KiB
19Accepted3/38ms4092 KiB
20Accepted3/39ms4188 KiB
21Accepted3/39ms4096 KiB
22Accepted3/38ms4220 KiB