84332024-01-16 09:38:28rancealexkriszVirágos rét (50 pont)cpp17Accepted 50/5020ms4184 KiB
#include <iostream>

using namespace std;

int main()
{

long long n,k,db=0,jo=0,x;
cin>>n>>k;
for(int i=1;i<=n;i++)
{
    cin>>x;
    if(x==1) db++;
}
if((db-k+1)>=0 and (db-k+2)>=0) cout<<(db-k+1)*(db-k+2)/2<<endl;
else cout<<0;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1876 KiB
2Accepted0/03ms2120 KiB
3Accepted0/019ms2332 KiB
4Accepted2/23ms2572 KiB
5Accepted2/23ms2788 KiB
6Accepted2/22ms2868 KiB
7Accepted3/33ms2836 KiB
8Accepted3/32ms2836 KiB
9Accepted3/33ms3036 KiB
10Accepted2/23ms3128 KiB
11Accepted3/33ms3340 KiB
12Accepted2/23ms3580 KiB
13Accepted3/33ms3800 KiB
14Accepted2/217ms3880 KiB
15Accepted2/218ms3872 KiB
16Accepted3/319ms3964 KiB
17Accepted3/318ms4068 KiB
18Accepted3/320ms3948 KiB
19Accepted3/319ms3948 KiB
20Accepted3/318ms4060 KiB
21Accepted3/319ms4060 KiB
22Accepted3/318ms4184 KiB