标签:return can pat std == main scanf else lse
#include<cstdio>
int main()
{
int num,step=0;
scanf("%d", &num);
while (num!=1)
{
if (num % 2 == 0) num /= 2;
else num = (3 * num + 1) / 2;
step++;
}
printf("%d", step);
return 0;
}
【PAT】B1001 害死人不偿命的(3n+1)猜想 (15)(15 分)
标签:return can pat std == main scanf else lse
原文地址:https://www.cnblogs.com/hebust/p/9498165.html