当前位置: 代码迷 >> 综合 >> PAT 1001 Basic Level
  详细解决方案

PAT 1001 Basic Level

热度:12   发布时间:2023-12-15 11:50:34.0

第一题很easy啦,而且还是中文的。 

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

 

  相关解决方案