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 lsw200838201 at 2009-08-04 20:24:03 on Problem 3278
if((ji+1)<100001&&a[ji+1]==0)
{
	a[ji+1]=a[ji]+1;
	q.push(ji+1);
}
if(a[ji-1]==0&&ji-1>=0)
{
	a[ji-1]=a[ji]+1;
	q.push(ji-1);
}
if((ji*2)<100001&&a[ji*2]==0)
{
	a[ji*2]=a[ji]+1;
	q.push(ji*2);
}
用上面这段代码A了,但是看下面:
if(a[ji+1]==0&&(ji+1)<100001)
{
	a[ji+1]=a[ji]+1;
	q.push(ji+1);
}
if(a[ji-1]==0&&ji-1>=0)
{
	a[ji-1]=a[ji]+1;
	q.push(ji-1);
}
if(a[ji*2]==0&&(ji*2)<100001)
{
	a[ji*2]=a[ji]+1;
	q.push(ji*2);
}
WA了,郁闷了我好半天,就是条件换了个位置,而且下面的代码运行4 68486时运行出错,请大牛们帮我找找原因,谢谢!
另小弟建了一个计算机联盟群,希望各位ACM牛人进群,谢谢~~

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