题面:https://ac.nowcoder.com/acm/contest/327/C
完全没看懂的题解,但是感觉很厉害就贴在这吧
题解:
以下是代码
#include<bits/stdc++.h> using namespace std; const int M = 1e5; typedef long double ll; int main() { ll n; cin >> n; ll x = 1, s = 1; while (x < n) { x = 3 * x + 1; s++; } cout << s; return 0; }
由于n很大,故用高精度long double来存储,意外的是没有t