delete pics to save space
This commit is contained in:
18
history_source/ccf 入门篇/U4/4.3.6.cpp
Normal file
18
history_source/ccf 入门篇/U4/4.3.6.cpp
Normal file
@ -0,0 +1,18 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int n,a;
|
||||
while(true)
|
||||
{
|
||||
cin>>n;
|
||||
a=1;
|
||||
while(n!=1)
|
||||
{
|
||||
if(n%2==0) n/=2;
|
||||
else n=3*n+1;
|
||||
a++;
|
||||
}
|
||||
cout<<a<<endl;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user