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 |
分析一下规律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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator