热门
输入一个整数x
输出函数值
3
5
10
41
#include <bits/stdc++.h> using namespace std; int f(int x) { if (x <= 0) return 0; if (x == 1) return 1; return 3 * f((x + 1) / 2) - 1; } int main() { int x; cin >> x; cout << f(x) << endl; return 0; }