8 条题解

  • 0
    @ 2024-7-24 11:26:40
    
    //#define int long long
    
    using namespace std;
    
    const int N = 1e3 +10;
    
    const int INF=0x3f3f3f;
    
    int n,m,z,sx,sy,ex,ey,a[N][N],b[N][N],d[N];
    
    int main(){
    
    cin>>n>>m>>z;    
        for(int i = 1;i<=n;i++){
            for(int j = 1;j<=m;j++){
                cin>>a[i][j];
                a[i][j] = a[i-1][j] + a[i][j-1]  - a[i-1][j-1] + a[i][j];
            }
        }
        for(int i = 1;i<=z;i++){
            cin>>sx>>sy>>ex>>ey;
            cout<<a[ex][ey] - a[sx-1][ey] - a[ex][sy-1]   + a[sx-1][sy-1]<<endl;
        }
        return 0;
    }
    
    
    

    信息

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