1025
448
449
1024
// 449 #include <iostream> #include <stdint.h> #include <cmath> using namespace std; uint64_t f(uint64_t n) { if (n == 2) return 5; // 2^2 = 4, 1~4 时结果为 5 return 2 * f(n -1) -1 + std::pow(2, n - 1); } int main() { cout << f(7) << endl; // 2^7 = 128 return 0; }
// 449
这道题你会答吗?花几分钟告诉大家答案吧!
扫描二维码,关注牛客网
下载牛客APP,随时随地刷题