4 solutions

  • 1
    @ 2025-8-26 9:36:06
    #include<bits/stdc++.h>
    using namespace std;
    int main(){
        int n=1005;
        int a[n][n];
        int h,w;
        cin>>h>>w;
        for(int i=1;i<=h;i++){
            for(int j=1;j<=w;j++){
                cin>>a[i][j];
            }
        }
        for(int i=1;i<=h;i+=2){
            for(int j=1;j<=w;j+=2){
               int s=a[i][j]+a[i+1][j]+a[i][j+1]+a[i+1][j+1]; 
               cout<<s/4<<" ";
            }
            cout<<endl;
        }
        return 0;
    }
    

    Information

    ID
    1028
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    7
    Tags
    # Submissions
    72
    Accepted
    14
    Uploaded By