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

果断暴力AC

Posted by 040940129 at 2011-12-13 12:35:11 on Problem 2019
#include<stdio.h>
#include<stdlib.h>
int main(){
	int n,b,k,**init,i,j,x,y,min,max;
	scanf("%d%d%d",&n,&b,&k);
	init=(int **)malloc(n*sizeof(int *));
	for(i=0;i<n;i++)
		init[i]=(int *)malloc(n*sizeof(int));
	for(i=0;i<n;i++)
		for(j=0;j<n;j++)
			scanf("%d",&init[i][j]);
	while(k--){
		scanf("%d%d",&x,&y);
		x--;y--;
		for(i=x,max=min=init[x][y];i<b+x;i++)
			for(j=y;j<b+y;j++){
				if(init[i][j]>max)
					max=init[i][j];
				if(init[i][j]<min)
					min=init[i][j];
			}
		printf("%d\n",max-min);
	}
	return 0;
}

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