poj 3051 Satellite Photographs dp水题
来源:互联网 发布:德国肥胖比例的数据网 编辑:程序博客网 时间:2024/05/16 11:10
水题,直接贴代码。
//poj 3051//sep9#include <iostream>using namespace std;char g[1024][128];int dp[1024][128]; int w,h,ans;int search(int x,int y){dp[x][y]=1;if(x+1<h&&g[x+1][y]=='*'&&dp[x+1][y]==0)dp[x][y]+=search(x+1,y);if(x-1>=0&&g[x-1][y]=='*'&&dp[x-1][y]==0)dp[x][y]+=search(x-1,y);if(y+1<w&&g[x][y+1]=='*'&&dp[x][y+1]==0)dp[x][y]+=search(x,y+1);if(y-1>=0&&g[x][y-1]=='*'&&dp[x][y-1]==0)dp[x][y]+=search(x,y-1);ans=max(ans,dp[x][y]);return dp[x][y];}int main(){memset(dp,0,sizeof(dp));scanf("%d%d",&w,&h);int i,j;for(i=0;i<h;++i)scanf("%s",g[i]);ans=0;for(i=0;i<h;++i)for(j=0;j<w;++j)if(dp[i][j]==0&&g[i][j]=='*')search(i,j);printf("%d",ans);return 0;}
0 0
- poj 3051 Satellite Photographs dp水题
- poj 3051 Satellite Photographs
- poj-3051 Satellite Photographs
- POJ 3051 Satellite Photographs
- POJ 3051 Satellite Photographs
- POJ 3051 Satellite Photographs 可能会
- POJ 3051 Satellite Photographs 笔记
- POJ 3051 Satellite Photographs 简单DFS
- poj 3051 Satellite Photographs 基础DFS
- poj 3051 Satellite Photographs 很基础的dfs
- Satellite Photographs
- POJ 3051 Satellite Photographs 图的连通块,dfs即可。大水题。
- Satellite Photographs
- Satellite Photographs--DFS
- Problem E: Satellite Photographs
- Satellite Photographs(dfs)
- Satellite Photographs(dfs)
- PKU3051 Satellite Photographs 简单DFS
- [wordpress搬家]nutch的二三事
- 最完整的英语词根词缀表(四)完
- array_walk 和 foreach, for 的效率的比较
- Linux网络环境下的ARP攻击
- Android中的Selector的用法
- poj 3051 Satellite Photographs dp水题
- Object类
- mysql定时任务
- RowEditing 使用(示例) 按钮显示文字更改
- [wordpress搬家]nginx 走起
- CentOS/Linux 双网卡绑定单一IP,网卡热备
- Nova usually error
- a与a:link、a:visited、a:hover、a:active
- 本报报道工商出击 端掉电游黑店