|
|
вернуться в форумWA6 Послано hatred 13 авг 2011 01:33 where is my mistake? #include <cstdio> #include <cmath> inline int lb(int n) { return ceil(log(double(n))/log(2.0)); } int main() { int n,k; scanf("%d%d",&n,&k); if (n<=k) printf("%d",lb(n)); else { int ans=lb(k); n-=1l << ans; ans+=n/k; if (n%k) ++ans; printf("%d",ans); } } Re: WA6 Послано Jobed 17 апр 2014 13:05 I got WA6 too...can you please tell me the case? Re: WA6 Послано BillSu 26 апр 2014 12:17 Your formula is wrong. Re: WA6 Whoever gets Wrong Answer at 6th test, try to change your way of finding the power of two. My solution got WA#6 when I calculated power of two this way: power = ceil(log(x)/log(2)); Better calculate it by multiplying it. Re: WA6 Could you explain, why it is better ? |
|
|