Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma comment(linker,"/STACK:128000000")
- #include <cstdio>
- #include <cstdlib>
- #include <cctype>
- #include <cstring>
- #include <cmath>
- #include <ctime>
- #include <deque>
- #include <string>
- #include <vector>
- #include <queue>
- #include <stack>
- #include <map>
- #include <set>
- #include <unordered_set>
- #include <unordered_map>
- #include <utility>
- #include <algorithm>
- #include <tuple>
- #include <iostream>
- #include <random>
- #include <list>
- #include <iomanip>
- #include <assert.h>
- #include <random>
- #include <complex>
- using namespace std;
- typedef long long ll;
- typedef double ld;
- typedef vector<ll> vl;
- typedef vector<vl> vvl;
- typedef vector<int> vi;
- typedef vector<vi> vvi;
- typedef pair<int, int> pii;
- typedef pair<double, double> ptd;
- const int inf = (int)1e9 + 1000;
- const ll infLL = 10000000000000001LL;
- const int mod = (int)1e9 + 7;
- const double eps = 1e-11;
- const double pi = 3.141592653589793;
- const int maxlen = (int)1e5 + 10;
- const int base = (int)1e9;
- const int dd = (int)100 + 10;
- #define ACCEPTED return 0;
- #define mp make_pair
- #define all(x) (x).begin(), (x).end()
- #define rall(x) (x).rbegin(), (x).rend()
- #define X first
- #define Y second
- #define optimize cin.sync_with_stdio(false);cout.sync_with_stdio(false);cin.tie(0);
- ll dp[31][40];
- int solve(int n, int x)
- {
- if(dp[n][x]!=-1)
- return dp[n][x];
- if(n==0)
- return dp[n][x] = 1;
- if(x==1)
- return dp[n][x]= (1<<n);
- if(x == 2)
- return dp[n][x] = solve(n-1, x-1);
- return dp[n][x] = 2* solve(n-1, x-1);
- }
- int main()
- {
- #ifdef _DEBUG
- freopen("input.txt", "rt", stdin);
- freopen("output.txt", "wt", stdout);
- #endif
- optimize;
- int n;
- cin >> n;
- memset(dp,-1,sizeof(dp));
- dp[1][2]=2;
- ll ans = solve(n,1);
- for(int x=2; x<=n+1; x++)
- ans+= 2* solve(n,x);
- cout << ans;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement