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

Re:原理

Posted by huicpc0860 at 2010-04-07 21:09:11 on Problem 2453
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:
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