Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Utopian Tree
- #include <iostream>
- using namespace std;
- int main()
- {
- int n, t[100] , dis=1, q=1;
- cin >> n;
- for(int i=0;i<n;i++)
- {
- cin >> t[i];
- for(int y=0;y<t[i];y++)
- {
- if(q==1){q=0;dis=dis*2;}
- else if(q==0){q=1;dis++;}
- }
- cout<<dis<<endl;
- dis=1;
- q=1;
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment