poj 2019 Cornfields
来源:互联网 发布:win10软件注册表 编辑:程序博客网 时间:2024/05/02 15:48
题目分析:给一个n*n的矩阵,给出坐标(x,y),求以(x,y)为左上角的b*b的子矩阵中最大值与最小值的差值,
暴力过的,据说要用RMQ
#include<iostream>#include<cstdio>#include<cstring>using namespace std;int matrix[300][300];int main(){int n,b,k;while(scanf("%d %d %d",&n,&b,&k)!=EOF){for(int i=1;i<=n;i++)for(int j=1;j<=n;j++)scanf("%d",&matrix[i][j]);for(int i=1;i<=k;i++){int x,y,max=0,min=250;scanf("%d %d",&x,&y);for(int j=x;j<=x+b-1;j++)for(int t=y;t<=y+b-1;t++){ if(matrix[j][t]<min)min=matrix[j][t]; if(matrix[j][t]>max)max=matrix[j][t];}printf("%d\n",max-min);}}//system("pause");return 0;}
- POJ 2019 Cornfields
- poj 2019 Cornfields
- poj 2019 Cornfields
- poj 2019 Cornfields
- POJ 2019: Cornfields
- POJ 2019 Cornfields
- poj 2019 Cornfields【RMQ】
- poj 2019 Cornfields
- Cornfields POJ - 2019
- POJ 2019 Cornfields 笔记
- POJ 2019 Cornfields [二维RMQ]
- POJ 2019 Cornfields(二维RMQ)
- POJ 2019 Cornfields 二维RMQ
- POJ--2019--Cornfields【二维RMQ】
- POJ 2019 Cornfields(水~)
- Cornfields - POJ 2019 单调队列
- POJ - 2019 Cornfields(二维RMQ)
- POJ 2019 Cornfields (二维RMQ)
- NSFileManager
- 开机启动tomcat
- Spring 注解总结
- PLSQL调试技巧
- uboot与linux的参数传递
- poj 2019 Cornfields
- uboot之u盘启动kernel
- where memory is allocate outside of Java heap. gc
- 通俗地说压缩音频格式
- 程序员到底怎么了
- JavaScript数字和字符串转换小结(转)
- 复制功能
- 基于博弈树启发式搜索的五子棋游戏
- 在C#中调用存储过程(WinForm)