题目链接:http://ybt.ssoier.cn:8088/problem_show.php?pid=1224
两个博客:门1,门2
门2是用的一维前缀和,门1的一维前缀和代码好像有点错误。
代码直接CV了:
这个代码里,这样输入矩阵的方式还是第一次见,前缀和是计算的每一列的。
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#define INF 999999999
#define N 1001
using namespace std;
int a[N][N],b[N][N];
void print(int n){
cout<<"********************************\n";
for(int i=0;i<=n;i++){
for(int j=0;j<=n;j++)
cout<<a[i][j]<<" ";
cout<<endl;
}
cout<<