1001害死人不偿命的(3n+1)猜想

---------------------------------------------------------

#include<stdio.h>
int main() {
int N;
int count = 0;
scanf_s("%d", &N);
while (1) {
if (N == 1) break;
else {
if (N % 2 == 0) 
N /= 2;
else if(N%2==1) 
N = (3 * N + 1)/ 2;
count++;
}
}
printf("%d", count);
return 0;
}

猜你喜欢

转载自blog.csdn.net/IDONTCAREq/article/details/79989544