UVA 11636

https://odzkskevi.qnssl.com/8d68abfe6e32509b1c446b13c725b0e4?v=1501696926

 

 

 1 #include <stdio.h>
 2 #include <iostream>
 3 using namespace std;
 4 
 5 int main(void){
 6     long n,t,step,ans;
 7     ans=1;
 8     while(scanf("%ld",&n)==1){
 9         if(n<0) break;
10         t=1;
11         step=0;
12         while(t<n){
13             t=t<<1;
14             step++;
15         }
16         printf("Case %ld: %ld\n",ans++,step);
17     }
18     return 0;
19 }

 

 1 #include <iostream>
 2 #include <stdio.h>
 3 using namespace std;
 4 int main(){
 5     int n,Case=1;
 6     while(scanf("%d",&n)==1&&n>0){
 7         int temp=1,ans=0;
 8         if(temp<n){
 9             temp*=2;
10             ans++;
11         }
12         printf("Case %d: %d\n",Case++,ans);
13     }
14     return 0;
15 }

 

posted @ 2017-08-09 11:13  浅忆~  阅读(157)  评论(0编辑  收藏  举报