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

Re:求大神啊。。本地运行通过提交runtime error discuss里面的测试数据都试过了。。表示过不去啊。。。

Posted by 03102057 at 2012-11-25 20:14:56 on Problem 1088
In Reply To:求大神啊。。本地运行通过提交runtime error discuss里面的测试数据都试过了。。表示过不去啊。。。 Posted by:GSMU at 2012-05-15 22:38:59
> #include<stdio.h>
> int matrix[100][100];//存储原始数据
> int cnt[100][100]; //存储中间结果
> int row ,col;
> int dp(int i,int j)
> {
>     int max=0;
>     if(cnt[i][j]>0)
>       return cnt[i][j];
>     if(j-1>=0)
>     {
>         if (matrix[i][j] > matrix[i][j-1])
>            if(max<dp(i,j-1))
>              max=dp(i,j-1);
>     }
>     if(i-1>=0)
>     {
>         if (matrix[i][j] > matrix[i-1][j])
>         if(max<dp(i-1,j))
>           max=dp(i-1,j);
>     }
>     if(i+1<=row-1)
>     {
>         if (matrix[i][j] > matrix[i+1][j])
>         if(max<dp(i+1,j))
>           max=dp(i+1,j);
>     }
>     if(j+1<=col-1)
>     {
>         if (matrix[i][j] > matrix[i][j+1])
>         if(max<dp(i,j+1))
>           max=dp(i,j+1);
>     }
>     return cnt[i][j]=max+1;
> }
> int main()
> {
>     int i,j;
>     while(scanf("%d%d",&row,&col)!=EOF)
>     {
>         for(i=0;i<=row;i++)
>           for(j=0;j<=col;j++)
>              cnt[i][j]=0;
>          for(i=0;i<row;i++)
>           for(j=0;j<col;j++)
>              scanf("%d",&matrix[i][j]);
>         for (i=0; i<=row-1; i++)
> 	    {
> 		    for (j=0; j<=col-1; j++)
> 		     {
> 			  dp(i, j);
> 			  // printf("1");
> 		    }
> 	     }
> 	    for(i=0;i<=row;i++)
> 	       for(j=0;j<=col;j++)
> 	       {
> 	           if(cnt[0][0]<cnt[i][j])
> 	              cnt[0][0]=cnt[i][j];
> 	       }
> 	       printf("%d\n",cnt[0][0]);
>     }
>     return 0;
> }

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator