Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

数据非常水,暴力过

Posted by yousiki at 2016-07-19 19:36:47 on Problem 2019
#include<cstdio>
using namespace std;
const int N=255,INF=1000000007;
int n,m,k;
int G[N][N];
#define max(i,j) (i>j?i:j)
#define min(i,j) (i<j?i:j)
signed main(void){
	scanf("%d%d%d",&n,&m,&k);
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
			scanf("%d",&G[i][j]);
	for(int t=1,x,y,Min,Max;t<=k;t++){
		scanf("%d%d",&x,&y);
		Min=INF;Max=-INF;
		for(int i=x;i<x+m;i++)
			for(int j=y;j<y+m;j++)
				Min=min(Min,G[i][j]),
				Max=max(Max,G[i][j]);
		printf("%d\n",Max-Min);
	}
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator