121862024-12-06 19:41:11szasztundeVirágos rét (50 pont)cpp17Accepted 50/5018ms520 KiB
#include <iostream>

using namespace std;

int main()
{
    long long db=0,n,x,k,dberedm=0;
    cin>>n>>k;
    for(int i=1;i<=n;i++)
    {
        cin>>x;
        if(x==1)
        {
            db++;
            if(db>=k) dberedm=dberedm+(db-k+1);
        }
    }
    cout<<dberedm;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/01ms320 KiB
2Accepted0/01ms320 KiB
3Accepted0/017ms512 KiB
4Accepted2/21ms508 KiB
5Accepted2/21ms320 KiB
6Accepted2/21ms320 KiB
7Accepted3/31ms320 KiB
8Accepted3/31ms320 KiB
9Accepted3/31ms320 KiB
10Accepted2/21ms320 KiB
11Accepted3/31ms520 KiB
12Accepted2/21ms508 KiB
13Accepted3/31ms320 KiB
14Accepted2/217ms404 KiB
15Accepted2/217ms400 KiB
16Accepted3/317ms400 KiB
17Accepted3/317ms408 KiB
18Accepted3/318ms400 KiB
19Accepted3/317ms320 KiB
20Accepted3/317ms404 KiB
21Accepted3/317ms508 KiB
22Accepted3/317ms320 KiB