#include<stdio.h>
void main()
{
int n, x;
scanf("%d",&n);
x = 0;
while (n != 1)
{
if (n % 2 == 0)
n = n / 2;
else
n = (3 * n + 1) / 2;
x++;
}
printf("%d", x);
}
PAT-乙级 1001 害死人不偿命的(3n+1)猜想(C语言)
猜你喜欢
转载自blog.csdn.net/tothk/article/details/104213502
今日推荐
周排行