Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #define pb push_back
- #define mp make_pair
- using namespace std;
- typedef unsigned int uint;
- typedef long long int llint;
- typedef pair<int, int> pii;
- void solve(llint n);
- llint power(llint n, llint r);
- //========================\\main//========================//
- int main()
- {
- int n;
- cin >> n;
- solve(n);
- return 0;
- }
- //========================\\main//========================//
- void solve(llint n)
- {
- llint res = 0;
- for(int i = 1; i <= n; i++)
- {
- res += power(2, i);
- } // end of for
- cout << res << "\n";
- }
- llint power(llint n, llint r)
- {
- llint res = 1;
- for(int i = 0; i < r; i++)
- {
- res = res * n;
- }
- return res;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement