hdu2064

hdu2064

汉诺塔变形,数学题

 1 #include
 2 long long A[36];
 3 int main(){
 4     A[1]=2;
 5     int i;
 6     for(i=2;i<=35;i++){
 7         A[i]=3*A[i-1]+2;
 8     }
 9     while(scanf("%d",&i)!=EOF){
10         printf("%I64d\n",A[i]);
11     }
12     return 0;
13 }
View Code

 

转载于:https://www.cnblogs.com/cenariusxz/p/6577949.html

你可能感兴趣的:(hdu2064)