[BZOJ1192][HNOI2006]鬼谷子的钱袋 数学

题目链接:http://www.lydsy.com/JudgeOnline/problem.php?id=1192

大水题,把m分成二的幂次方和。

 1 #include<cstdio>
 2 #include<cstring>
 3 #include<algorithm>
 4 using namespace std;
 5 int main(){
 6     int m;
 7     scanf("%d",&m);
 8     int sum=1,ans=0;
 9     while(1){
10         ans++;
11         sum<<=1;
12         if(m<sum){
13             printf("%d
",ans);
14             return 0;
15         } 
16     }
17 }
原文地址:https://www.cnblogs.com/halfrot/p/7553530.html