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

终于知道自己为什么那么多测试数据过了还是WA,哈哈

Posted by 1272406003 at 2010-04-11 12:03:15 on Problem 3009
其实很早就编好了code,但却一直wa,测试和讨论里的数据全部都能过,还是wa!

这时的我根本静不下心来重新检查code,等到几乎绝望时,才来看看代码!~ 
哎呀,我的天:
		while (tempx>=0&&mymap[tempx][tempy]==0)
		{
			if(tempx==endx&&tempy==endy )   {moves=now;find=true;return;}
			tempx--;
		}
                //if(mymap[tempx][tempy]==1)修改前的
		if(tempx>=0&&mymap[tempx][tempy]==1)
		{
			mymap[tempx][tempy]=0;
			dfs(tempx+1,tempy,now+1);
			mymap[tempx][tempy]=1;
		}
看看上面的代码,只是少了一个判断tempx>=0,因为前面已经tempx,这不判断的话,就出问题了!加上这样的判断(当然4个方向都加上这样的判断,就ac了)

我的思想是迭代加深过的!还行100ms之内

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