循环的地方需要稍微注意下

#include <bits/stdc++.h>

int main() {
int N;
std::cin >> N;
int result[400], length = 1;
memset(result, 0, sizeof(result));
result[0] = 1;

for (int i = 1; i <= N; ++i) {
// 进位不能放在循环中计算,小黄鸭一下就懂了.....我自己傻逼了半天
int doPlusOne = 0;
for (int j = 0; j < length; ++j) {
result[j] = result[j] * 2 + doPlusOne;
doPlusOne = result[j] / 10;
result[j] = result[j] % 10;
if (doPlusOne != 0 && j + 1 == length) {
length++;
}
}

}


for (int i = 0; i < length; ++i) {
std::cout << result[length - i - 1];
}
return 0;
}