#include using namespace std;

int main() { int n; cin >> n;

int num = 1; // 初始只有1只小母猪
int total = 1; // 初始总数为1
for (int i = 2; i <= n; i++) {
    num = num * 2; // 第i年小母猪的数量是前一年的两倍
    total = total + num * 2; // 第i年总数是前一年总数加上小母猪的数量乘以2
}

cout << total << endl;

return 0;

}


原文地址: https://www.cveoy.top/t/topic/p4Qw 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录