85592024-01-21 21:24:51qertendVirágos rét (50 pont)cpp17Accepted 50/5019ms3152 KiB
#include <iostream>

using namespace std;
int N, K;
long long db1=0; //1-ek szama
//long long ered=0;
int x;
void be()
{
    cin>>N>>K;
    for(int i=1;i<=N;i++)
    {
        cin>>x;
        if(x==1)db1++;
        //db1+=x;
    }
}

int main()
{
    be();
    if(db1>=K) cout<<(db1-K+1)*(db1-K+2)/2;
    else cout<<0;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1876 KiB
2Accepted0/03ms2068 KiB
3Accepted0/019ms2148 KiB
4Accepted2/23ms2284 KiB
5Accepted2/22ms2364 KiB
6Accepted2/23ms2488 KiB
7Accepted3/33ms2576 KiB
8Accepted3/33ms2708 KiB
9Accepted3/33ms2816 KiB
10Accepted2/23ms2800 KiB
11Accepted3/33ms2952 KiB
12Accepted2/23ms3036 KiB
13Accepted3/33ms2988 KiB
14Accepted2/217ms2996 KiB
15Accepted2/217ms3088 KiB
16Accepted3/319ms3108 KiB
17Accepted3/318ms3112 KiB
18Accepted3/319ms3148 KiB
19Accepted3/318ms3144 KiB
20Accepted3/318ms3144 KiB
21Accepted3/319ms3152 KiB
22Accepted3/318ms3148 KiB