Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
一诡异现象忘大牛们解释!!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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator