1 #include<iostream>
 2 using namespace std ;
 3 int main()    
 4 {
 5     int n ;
 6     while(cin >> n)    {
 7         int sum = 1<<n ;
 8         cout << sum + 1 << endl ;
 9     }
10     return 0 ;
11 }
 1 #include <iostream>
 2 #include <cmath>
 3 using namespace std;
 4 int main()
 5 {
 6     int t1 = 1,t2 = 0,t3 = 1,n;
 7     cin>>n;
 8     for(int i = 1; i <= n; ++i)
 9     {
10         t3 += t2;
11         t2 = t1;
12         t1 = pow(2,i-1);
13     }
14     cout<<t1+t2+t3<<endl;
15     return 0;
16 }

 

相关文章:

  • 2021-09-01
  • 2021-07-08
  • 2022-12-23
  • 2021-05-31
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-12-08
  • 2021-10-06
  • 2021-12-29
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案