8 条题解

  • 1
    @ 2023-3-12 15:48:29
    /*********************************
           all rights reserved.
    *********************************/
    #include<bits/stdc++.h>
    using namespace std;
    int n,m,f[1005][1005],k,x1,x2;
    int y3,y2,x;
    int main()
    {    
        cin>>n>>m>>k;
        for(int i=1;i<=n;i++) {
        	for(int j=1;j<=m;j++) {
        		cin>>x;
        		f[i][j]=x+f[i-1][j]+f[i][j-1]-f[i-1][j-1];
    		}
    	}
    	while(k--) {
    		cin>>x1>>y3>>x2>>y2;
    		cout<<f[x2][y2]-f[x1-1][y2]-f[x2][y3-1]+f[x1-1][y3-1]<<"\n";
    	}
        return 0;
    }
    

    信息

    ID
    1283
    时间
    1000ms
    内存
    256MiB
    难度
    6
    标签
    递交数
    703
    已通过
    228
    上传者