#include <iostream>
#include <algorithm>
using namespace std;
const int N=3010;
int main() {
int a[N] = {1};//初始化
int n;
int m = 1;
cin>>n;
for (int i = 0; i < n; i++) {
int t = 0;//局部变量
for (int j = 0; j < m; j++) {
t += a[j] * 2;
a[j] = t % 10;
t /= 10;
}
if (t)
a[m++]=1;
}
for(int i=m-1;i>=0;i--)//倒序输出
cout<<a[i];
return 0;
}
回进次循环,给t赋值后面m也就有值了