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

谁能说说为什么continue会快这么多?

Posted by alpc62 at 2007-09-23 17:56:41 on Problem 3385
In Reply To:自己改了改,试了试,还是运算问题?奇怪了。 Posted by:alpc62 at 2007-09-23 17:15:24
> 2S时限,原先G++ TLE而C++ 225MS AC:
> for (res=i=0;i<=n;i++)
> 	if (a[i]>d)	res+=(a[i]-2)/(d-1);
> 
> 改成下面这样 G++ 991MS AC:
> for (res=i=0;i<=n;i++)
> {
> 	if (a[i]<=d)	continue;
> 	res+=(a[i]-2)/(d-1);
> }
> 
> 真奇怪!!continue在G++能够使if加速一倍?

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