90522024-02-13 09:02:57PedriVirágos rét (50 pont)cpp17Accepted 50/5019ms4156 KiB
#include <iostream>
#include <fstream>

using namespace std;
int n, m;


int main()
{
    ifstream f("be.in");
    cin>>n>>m;
    int k=0;
    for(int i=1;i<=n;i++){
        int x;
        cin>>x;
        if(x==1){k++;}
    }
    long long s=0;
    for(int i=1;i<=k-m+1;i++){
        for(int j=i+m-1;j<=k;j++){
            s++;
        }
    }
    cout<<s;




    return 0;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1812 KiB
2Accepted0/03ms2000 KiB
3Accepted0/019ms2216 KiB
4Accepted2/23ms2456 KiB
5Accepted2/23ms2684 KiB
6Accepted2/22ms2756 KiB
7Accepted3/33ms2884 KiB
8Accepted3/33ms3100 KiB
9Accepted3/33ms3144 KiB
10Accepted2/23ms3144 KiB
11Accepted3/33ms3152 KiB
12Accepted2/23ms3276 KiB
13Accepted3/33ms3664 KiB
14Accepted2/218ms3652 KiB
15Accepted2/218ms3720 KiB
16Accepted3/319ms3716 KiB
17Accepted3/318ms3720 KiB
18Accepted3/319ms3832 KiB
19Accepted3/319ms3724 KiB
20Accepted3/319ms3812 KiB
21Accepted3/319ms4060 KiB
22Accepted3/319ms4156 KiB