import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
// int n = Integer.parseInt(sc.nextLine());
int n = sc.nextInt();
int count = 0;
do {
if(n%2!=0) {
n = 3*n+1;
n = n/2;
}else {
n = n/2;
}//判斷奇偶性
count++;
}while(n!=1);
System.out.print(count);
}
}
PAT (B) 題目1001
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.