从角谷猜想来的。
2026-08-05 21:00:12
发布于:浙江
7阅读
0回复
0点赞
从角谷猜想来的。
#include <iostream>
using namespace std;
long long n;
int main()
{
cin >> n;
if(n == 1)
{
cout << "End";
return 0;
}
while(n != 1)
{
if(n % 2 == 1)
{
cout << n << "->";
n = n * 3 + 1;
}
else
{
cout << n << "->";
n /= 2;
}
}
cout << 1;
return 0;
}
有用请点个赞。
这里空空如也






有帮助,赞一个