[HNOI2006]鬼谷子的钱袋

题目:BZOJ1192

题目大意:略,见原题。

思路:求出比$n$大的最小的$2^k-1$的数的(k)。设$2^k=m$,则$k=log_2 m$,如有多则进1。

C++ Code:

#include<cstdio>
#include<cmath>
int main(){
	int n;
	scanf("%d",&n);
	printf("%d
",(int)log2(n)+1);
	return 0;
}
原文地址:https://www.cnblogs.com/Mrsrz/p/6973555.html