poj1088
来源:互联网 发布:在线矩阵计算器 编辑:程序博客网 时间:2024/06/05 17:34
// poj.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include<iostream>
using namespace std;
int a[200][200];
int l[4][2]={{1,0},{0,-1},{-1,0},{0,1}};
int r,c;
int DP(int i, int j)
{
bool visited[200][200];
memset(visited,sizeof(bool),false);
int len;
int max=-1;
for(int k=0;k<4;k++)
{
if((i+l[k][0])>=0&&(i+l[k][0])<r&&(j+l[k][1])>=0&&(j+l[k][1])<c&&a[i+l[k][0]][j+l[k][1]]<a[i][j]&&(!visited[i+l[k][0]][j+l[k][1]]))
{
len=DP(i+l[k][0],j+l[k][1])+1;
if(len>max)
max=len;
}
}
return max;
}
int main()
{
cin>>r>>c;
for(int i=0;i<r;i++)
{
for(int j=0;j<c;j++)
{
cin>>a[i][j];
}
}
int max_dp=-1;
for(int i=0;i<r;i++)
{
for(int j=0;j<c;j++)
{
if(DP(i,j)>max_dp)
max_dp=DP(i,j);
}
}
cout<<max_dp<<endl;
return 0;
}
- POJ1088
- poj1088
- POJ1088
- POJ1088
- Poj1088
- poj1088
- POJ1088
- poj1088
- poj1088
- poj1088
- poj1088
- poj1088
- POJ1088
- POJ1088
- poj1088
- poj1088
- poj1088
- poj1088
- VTK基础概念
- Android组件简记
- Leetcode_Compare Version Numbers
- 求职实习生面试问题
- 非软网络www.2ubu.com
- poj1088
- YT14-HDU-圆桌会议
- Windows下 maven3.0.4的安装步骤+maven配置本地仓库
- 从硬盘安装Windows 7的方法汇总
- 【Servlet笔记】Servlet的转发(其他servlet、静态页面、JSP)
- 写给自己的北漂生存之毕业回顾
- 线程及其通信
- MongoDB Windows环境安装及配置
- 笔记本+Ubuntu14.04+cuda6.5+caffe的配置详解