Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
Register

## Re:0 MS 代码附上

Posted by ds570 at 2017-04-06 20:41:31 on Problem 1088
In Reply To:0 MS 代码附上 Posted by:2016202202 at 2017-03-01 08:46:50
```> #include<stdio.h>
> #include<string.h>
> #include<stdlib.h>
> #define N 128
> int a[N][N];
> int num[N][N];
> int n,m;
>
> int dp(int i,int j)
> {
> 	if(a[i][j] != 0)return a[i][j];
> 	int maxn = 0;
> 	if(i - 1 > 0 && j > 0 && num[i][j] > num[i - 1][j] && dp(i - 1,j) > maxn)
> 	{
> 		maxn = a[i - 1][j];
> 	}
> 	if(i > 0 && j - 1 > 0 && num[i][j] > num[i][j - 1] && dp(i,j - 1) > maxn)
> 	{
> 		maxn = a[i][j - 1];
> 	}
> 	if(i > 0 && j + 1 <= n && num[i][j] > num[i][j + 1] && dp(i, j + 1) > maxn)
> 	{
> 		maxn = a[i][j + 1];
> 	}
> 	if(i + 1 <= m && j > 0 && num[i][j] > num[i + 1][j] && dp(i + 1,j) > maxn)
> 	{
> 		maxn = a[i + 1][j];
> 	}
> 	a[i][j] = maxn + 1;
> 	return a[i][j];
> }
> int main()
> {
> 	scanf("%d%d",&m,&n);
> 	for(int i = 1;i <= m;i ++)
> 	{
> 		for(int j = 1;j <= n;j ++)
> 		{
> 			scanf("%d",&num[i][j]);
> 		}
> 	}
> 	int max = 0;
> 	for(int i = 1;i <= m;i++)
> 	{
> 		for(int j = 1;j <= n;j ++)
> 		{
> 			a[i][j] = dp(i,j);
> 			if(max < a[i][j])
> 				max = a[i][j];
> 		}
> 	}
> 	printf("%d\n",max);
> }
```

Followed by: