标签:div png return clu printf mamicode == pre alt
1 #include<stdio.h> 2 3 int main(){ 4 int n = 0; 5 int num = 0; 6 //printf("请输入一个不超过1000的正整数:"); 7 scanf("%d", &num); 8 while(num != 1){ 9 if(num%2 == 0){ 10 num = num / 2; 11 n++; 12 }else{ 13 num = (3*num + 1) / 2; 14 // printf("%d\n",num)]; 15 n++; 16 } 17 } 18 printf("%d\n", n); 19 return 0; 20 21 }
PTA 乙级 1001 害死人不偿命的(3n+1)猜想 (15分)
标签:div png return clu printf mamicode == pre alt
原文地址:https://www.cnblogs.com/SCP-514/p/13190947.html