| ||||||||||
| 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 | |||||||||
谁能说说为什么continue会快这么多?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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator