#include<iostream>
using namespace std;
#define MAXNUM 2000
int arr[MAXNUM];
int main(){
int n,index,i;
cin>>n;
index=0;
for( i=0;i<MAXNUM;i++){
arr[i]=0;
}
arr[0]=2;
for( i=1;i<n;i++){
int jinwei=0;
for(int j=0;j<=index;j++){
int temp=1;
if(j==0){
temp=arr[j]*2;
if(temp>=10){
jinwei=1;
}
}
else{
temp=arr[j]*2;
if(jinwei==1){
temp=temp+1;
}
if(temp>=10){
jinwei=1;
}
else{
jinwei=0;
}
}
arr[j]=temp%10;
}
if(jinwei==1){
index++;
arr[index]=1;
}
}
for( i=index;i>=0;i--){
cout<<arr[i];
}
cout<<endl;
return 0;
}
c++实现2的n次方
最新推荐文章于 2024-08-31 16:13:59 发布