4 solutions

  • 0
    @ 2022-3-14 13:56:19
    #include <stdio.h>
    #include <algorithm>
    #include <math.h>
    #include <vector>
    #include <iostream>
    #include <string.h>
    #include <queue>
    using namespace std;
    int n,m,ans;
    char a[2005][2005];
    char b[2005];
    int main() {
        scanf("%d%d",&n,&m);
        for(int i=0; i<n; i++)
            scanf("%s",&a[i]);
        scanf("%s",&b);
        for(int i=0; i<n; i++) {
            int temp=0;
            for(int j=0; j<n; j++) {
                if(a[i][j]=='0') {
                    temp++;
                } else {
                    temp=0;
                    continue;
                }
                if(temp>=m) {
                    ans++;
                }
            }
        }
    printf("%d\n",ans);
    return 0;
    }
    

    Information

    ID
    129
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    7
    Tags
    # Submissions
    212
    Accepted
    57
    Uploaded By