OJ-Problems-Source/HDOJ/1210_autoAC.cpp

21 lines
330 B
C++
Raw Normal View History

2016-08-13 17:16:08 +08:00
#include<stdio.h>
int main()
{
int m,x,ans;
while(~scanf("%d",&m))
{
x=1;
ans = 0;
do
{
if(x<=m)
x = 2*x;
else
x = 2*(x-m)-1;
ans++;
}
while(x!=1);
printf("%d\n",ans);
}
}