题面: 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
来源: http://www.bubuko.com/infodetail-2932791.html