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

各位牛人,帮小第看看哪里有错,几组数据都过了

Posted by zhongdian at 2007-12-30 10:24:45 on Problem 1088
#include<iostream>

using namespace std;

int main(void)
{
	int a[104][104] = {-1},b[104][104]={1};
	int r,c,flg1,i,j,max = 0,k1,k2;
	
	cin >> r >>c;
	
	for(i =1; i <= r; i++)
		for(j = 1; j <= c; j++)
			cin >> a[i][j];
		
		flg1 = 1;
		
		while(flg1 == 1)
		{
			flg1 = 0;
			
			for(i =1; i <= r; i++)
				for(j = 1; j <= c; j++)
					for(k1 = i-1; k1 <=i+1; k1++)
						for(k2 = j-1; k2 <=j+1; k2++)
							if( a[k1][k2] != -1 )
								if(a[i][j] > a[k1][k2] && b[i][j] < b[k1][k2] +1)
								{
									b[i][j] = b[k1][k2] +1;
									
									if( b[i][j] > max )
										max = b[i][j];
									
									flg1 = 1;
						
								}
						
							
		}
		
		cout << max << endl;
		
		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