题解:AT_nikkei2019ex_e コラッツ問題
lailai0916 · · 题解
解题思路
设
样例 #2 给了
参考代码
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
int p;
cin>>p;
ll f=1789997546303;
for(int i=1000;i>p;i--)f=f&1?f*3+1:f>>1;
cout<<f<<'\n';
return 0;
}