120122024-11-24 17:24:34ruffbrigiVirágos rét (50 pont)cpp17Wrong answer 42/5019ms732 KiB
#include <iostream>

using namespace std;

int main()
{
    int k,n,db1=0;;
    cin>>n;
    cin>>k;
    int a[n];
    for(int i=0;i<=n-1;i++)
    {
        cin>>a[i];
    }
    for(int i=0;i<=n-1;i++)
    {
        if(a[i]==1) db1++;
    }
    if(db1<k) cout<<"0";
    else cout<<((db1-k+1)*(db1-k+2))/2;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base42/50
1Accepted0/01ms320 KiB
2Accepted0/01ms320 KiB
3Accepted0/019ms604 KiB
4Accepted2/21ms320 KiB
5Accepted2/21ms320 KiB
6Accepted2/21ms320 KiB
7Accepted3/31ms320 KiB
8Accepted3/31ms320 KiB
9Accepted3/31ms320 KiB
10Accepted2/21ms320 KiB
11Accepted3/31ms320 KiB
12Accepted2/21ms320 KiB
13Accepted3/31ms320 KiB
14Accepted2/217ms616 KiB
15Wrong answer0/217ms588 KiB
16Accepted3/318ms644 KiB
17Accepted3/317ms592 KiB
18Wrong answer0/318ms704 KiB
19Accepted3/318ms732 KiB
20Accepted3/318ms656 KiB
21Accepted3/318ms596 KiB
22Wrong answer0/318ms568 KiB