poj2029 2010.4.14
来源:互联网 发布:淘宝红包口令在哪里 编辑:程序博客网 时间:2024/04/29 12:45
poj2029 2010.4.14
跟分割矩阵的存储方式相同
dp[i][j]:以(1,1)为左上角,以(i,j)为右下角的矩阵柿子树的数目。
#include <cstdio>#include <cstring>#define LEN 102int dp[LEN][LEN];int w,h;int s,t;int n;void init(){int i;for(i=1;i<=n;i++){int x,y;scanf("%d %d",&x,&y);dp[y][x]=1;}}int calit(int x,int y){int xx=x-t,yy=y-s;int ans=dp[x][y]-dp[xx][y]-dp[x][yy]+dp[xx][yy];return ans;}int max(int x,int y){if (x>y) return x;else return y;}int main(){int i,j;while (scanf("%d",&n),n){scanf("%d %d",&w,&h);memset(dp,0,sizeof(dp));init();for(i=1;i<=h;i++)for(j=1;j<=w;j++)dp[i][j]+=(dp[i-1][j]-dp[i-1][j-1]+dp[i][j-1]);int ans=0;scanf("%d %d",&s,&t);for(i=t;i<=h;i++)for(j=s;j<=w;j++)ans=max(ans,calit(i,j));printf("%d\n",ans);}return 0;}
0 0
- poj2029 2010.4.14
- poj2029
- poj2029
- poj2029
- poj2029
- poj2029 Get Many Persimmon Trees
- POJ2029--Get Many Persimmon Trees
- poj2029 Get Many Persimmon Trees
- poj2029 Get Many Persimmon Trees
- POJ2029 Get Many Persimmon Trees
- poj2029 Get Many Persimmon Trees
- 树状数组学习笔记+poj2029
- POJ2029——Get Many Persimmon Trees
- poj2029--Get Many Persimmon Trees(dp)
- POJ2029 Get Many Persimmon Trees(树状数组~)
- POJ2029:Get Many Persimmon Trees(DP)
- POJ2029--Get Many Persimmon Trees(枚举+二维树状数组)
- POJ2029:Get Many Persimmon Trees(二维树状数组)
- Ceph命令之ceph
- ucore中Makefile 内核文件组织全解析,学习软件的组织方式
- oracle 11g em配置数据库
- cmake制作deb包
- xml查找
- poj2029 2010.4.14
- Error:(1, 0) Plugin is too old, please update to a more recent version, or set ANDROID_DAILY_OVERRID
- 你的计划为什么执行不下去?
- BZOJ-1901 Zju2112 Dynamic Rankings 函数式线段树 套 树状数组+离线处理
- poj1029 2010.4.14
- Ceph命令之ceph mon(Monitor管理)
- poj1112 2010.4.15
- City Game
- postgresql启用归档