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 |
Re:原理In Reply To:原理 Posted by:huicpc0860 at 2010-04-07 20:50:24 先求右数第一个1:x=n&-n;将11..块最左的1左移一位,其余的清零:n+x;求得比原来的11..块多一个1并左移了一位的11..块:n^n+x;因为要移到最右端,所以去掉尾0:(n^n+x)/x;在右移两位就是其余的11..(因为先左移了一位,又是除左数第一个1的11..块):(n^n+x)/4;最后加到n+x就可以了。 Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator