4 solutions

  • -1
    @ 2025-8-26 15:01:51
    
    #include<bits/stdc++.h>
    using namespace std;
    int main(){
    	//freopen("image.in","r",stdin);
    	//freopen("image.out","w",stdout);
    	int h,w,c=1,d=1,a[1000][1000],b[100][100];
    	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){
    			b[c][d]=(a[i][j]+a[i][j+1]+a[i+1][j]+a[i+1][j+1])/4;
    			cout<<b[c][d]<<" ";
    			d+=1;
    		}
    		c+=1;
    		d=1;
    		cout<<endl;
    	}
        return 0;
    }
    ```
    
    
    ```

    Information

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