#14686: c++ AC


barry_1111 (123)

學校 : 臺北市私立延平高級中學
編號 : 69059
來源 : [203.72.178.252]
最後登入時間 :
2019-06-14 17:00:16
a694. 吞食天地二 | From: [203.72.178.252] | 發表日期 : 2018-07-31 13:21

#include <bits/stdc++.h>
using namespace std ;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char** argv) 
{
	ios::sync_with_stdio(false) ;
	int n,m ;
	while(cin>>n>>m)
	{
		int a[n+1][n+1] ;
		for(int i=1; i<=n; i++)
			for(int j=1; j<=n; j++) cin>>a[i][j] ;
		int x1,y1,x2,y2 ;
		while(m--)
		{
		cin>>x1>>y1>>x2>>y2 ;
		int sum=0 ;
		for(int i=x1; i<=x2; i++)
			for(int j=y1; j<=y2; j++) sum+=a[i][j] ;
		cout << sum << "\n" ;		
		}	
	}
	return 0;
}
 
ZeroJudge Forum