#include "iostream"
const int N = 10000;
using namespace std;
// 高精度算法 反着存 a[0]存放的是最高位数 如果有进位的话从数组最后一个进更简单
int main(){
int a[N] = {1};
int n;
int m = 1; //定义一个m来统计有多少位数 开始只有一位
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; //然后有进位的话这一位就是两位数里面的个位数,所以模10
t/=10; //两位数里面的十位数
}
if(t){
a[m] = 1;
m++;
}
}
for(int i = m-1; i >= 0; i--) printf("%d",a[i]);
cout<<endl;
return 0;
}
04-24
257
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
06-22
3596
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
01-12
492
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
07-05
164
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)