mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
21 lines
330 B
C++
21 lines
330 B
C++
|
#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);
|
||
|
}
|
||
|
}
|