Problem Type : Number Theory
#include<stdio.h>
#include<math.h>
int main()
{
long int i,j,input,count=0;
while(scanf("%ld",&input)==1)
{
count++;
if(input<=0)
break;
for(i=1; ; i++)
{
j= pow(2,i);
if(input ==1)
{
printf("Case %ld: 0\n",count);
break;
}
else if(j>=input)
{
printf("Case %ld: %ld\n",count,i);
break;
}
}
}
return 0;
}
#include<stdio.h>
#include<math.h>
int main()
{
long int i,j,input,count=0;
while(scanf("%ld",&input)==1)
{
count++;
if(input<=0)
break;
for(i=1; ; i++)
{
j= pow(2,i);
if(input ==1)
{
printf("Case %ld: 0\n",count);
break;
}
else if(j>=input)
{
printf("Case %ld: %ld\n",count,i);
break;
}
}
}
return 0;
}
No comments:
Post a Comment