上代码
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner a=new Scanner(System.in);
int x=a.nextInt();
int n=0;
for(n=0;x!=1;n++){
if(x%2==0){
x=x/2;
}
else {
x=3*x+1;
}
}
System.out.println(n);
}
}