我脑洞大了。。。。。

以为是个找规律。。。。。

原来只是模拟。。。。。

我相信肯定是有规律的。。。。。

但是我就是不愿意了。。。。。

#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<algorithm>

using namespace std;

int main()
{
    int n;
    int sum=0;
    cin >> n;
    while (n!=1)
    {
        if(n%2 == 0)
            n/=2;
        else
            n = (n*3+1)/2;
        sum++;
    }
    cout<<sum<<endl;
    return 0;  
}

相关文章:

  • 2022-01-25
  • 2021-09-01
  • 2021-09-27
  • 2019-03-04
  • 2021-09-18
  • 2021-05-09
  • 2021-12-07
  • 2021-12-04
猜你喜欢
  • 2021-08-21
  • 2019-12-08
  • 2022-01-01
  • 2021-11-13
  • 2021-10-02
  • 2021-07-18
  • 2021-05-19
相关资源
相似解决方案