Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdio>
- #include<vector>
- using namespace std;
- int pot(int a, int n)
- {
- int w = 1;
- while(n>0)
- {
- if (n%2 == 1)
- w *= a;
- a*= a;
- n/=2;
- }
- return w;
- }
- int main ()
- {
- int n,y,maks=0,a,h;
- vector <int> t;
- cin>>n;
- y=pot(2,n);
- y--;
- for(int i=1; i<=y; i++)
- {
- cin>>h;
- t.push_back(h);
- }
- for(int i=1; i<=y; i++)
- {
- y=t[2*i]+t[(2*i)+1];
- if(y>maks) maks=y;
- }
- cout<<maks;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement