Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
果断暴力AC#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator