1 题目要求
https://www.patest.cn/contests/pat-b-practise/1001
2 源代码
#include <stdio.h> int main(void) { int n; int count=0; scanf("%d",&n); while(n!=1){ if(n%2==0) n=n/2; else n=(3*n+1)/2; count++; } printf("%d ",count); }
3 评测结果 :通过!
这题其实也没有复杂的逻辑关系,主要还是理解题意。