This commit is contained in:
xice09
2018-08-01 02:30:29 +08:00
parent 36f2ab51ab
commit cc6cf4cdea
10 changed files with 261 additions and 0 deletions

15
2013.cpp Normal file
View 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;
}