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

分析一下规律

Posted by Ontheline at 2009-04-10 16:12:22 on Problem 2309
1)首先判断读入数x的奇偶性,如果是奇数,那么输出其自身就好了,原因是x肯定为树的叶子节点.
2)如果是偶数,那么首先打表,从2^1,2^2,........,2^30,y=x,连续运算y=y-2^i,知道y==0退出,每次的i为最接近y的幂.
3)利用计算出的i,在x的左侧一定存在2^(i-1)个奇数,右侧也一定存在2^(i-1)个奇数,分别求出最大奇数,和最小奇数即可.

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