哪里错了?求助

P1719 最大加权矩形

kn_wlq @ 2023-03-06 21:40:38

#include<iostream>
using namespace std;
int sum[100005];
int main(){
    int n,m,x1,x2,y1,y2;
    cin>>m>>n;
    cin>>x1>>y1>>x2>>y2;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            int s=sum[x2][y2]-sum[x1-1][y2]-sum[x2][y1-1]+sum[x1-1][y1-1];
        }
    }   cout<<s;
}

by Link_Wink_Y @ 2023-03-06 21:44:28

啊不是题号呢?


by kn_wlq @ 2023-03-06 21:50:04

@Thunder__ p1719哈


by ZM____ML @ 2023-03-06 21:50:36

@kn_wlq 首先,你这个式子就是错误的,你这个式子这么写完全不需要循环


by Link_Wink_Y @ 2023-03-06 21:51:32

哦,对不起(看看我的个人简介)


by kn_wlq @ 2023-03-06 21:52:18

@ZM____ML 谢谢谢谢,万分感谢


by kn_wlq @ 2023-03-06 21:53:20

@Thunder__ 哦哦


by ZM____ML @ 2023-03-06 21:54:02

@kn_wlq 太简洁了我都不理解,建议先读一遍题,读入直接消失吗(


by ZM____ML @ 2023-03-06 21:54:54

@kn_wlq 读入+前缀和处理+动规

差不多是这么一个思路


by kn_wlq @ 2023-03-06 21:55:01

@ZM____ML 好的


|