10-19 AC
This commit is contained in:
15
2013.cpp
Normal file
15
2013.cpp
Normal file
@@ -0,0 +1,15 @@
|
||||
#include <iostream>
|
||||
#include <cmath>
|
||||
using namespace std;
|
||||
int main(){
|
||||
// a1 = 1
|
||||
// an = 2(an-1 + 1)
|
||||
// an + 2 = 2(an-1 + 2)
|
||||
// an + 2 = 3*2^(n-1)
|
||||
// an = 3*2^(n-1) - 2
|
||||
int x;
|
||||
while (cin >> x){
|
||||
cout << 3*(long long)pow(2,x-1)-2 << endl;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user