1
+ #include < bits/stdc++.h>
2
+
3
+ #define fast ios_base::sync_with_stdio (0 );cin.tie(NULL );cout.tie(NULL )
4
+ #define f (i,a,b ) for (auto i=a;i<b;i++)
5
+ #define fi (i,a,b,x ) for (auto i=a;i<b;i=i+x)
6
+ #define fe (i,a,b ) for (auto i=a;i<=b;i++)
7
+ #define fr (i,a,b ) for (auto i=a;i>=b;i--)
8
+ #define loop (i, a ) for (auto i=a.begin();i!=a.end();i++)
9
+ #define endl ' \n '
10
+ #define sp ' \t '
11
+ #define ll long long int
12
+ #define ff first
13
+ #define ss second
14
+ #define pb push_back
15
+ #define mp make_pair
16
+ #define all (x ) x.begin(), x.end()
17
+ #define clr (x ) memset(x, 0 , sizeof (x))
18
+ #define sortall (x ) sort(all(x))
19
+ #define mod 1000000007
20
+ #define PI 3.1415926535897932384626
21
+ #define deb (x ) cout<<#x<<" =" <<x<<endl
22
+ #define deb2 (x, y ) cout<<#x<<" = " <<x<<" , " <<#y<<" = " <<y<<endl
23
+
24
+ using namespace std ;
25
+
26
+ template <typename T>
27
+ void print (vector<T>& a, char sep)
28
+ {
29
+ for (auto i : a) { cout<<i<<sep; }
30
+ }
31
+
32
+ ll mod_opr (ll num)
33
+ {
34
+ return (num + mod) % mod;
35
+ }
36
+
37
+ template <typename T>
38
+ bool compare (T x, T y)
39
+ {
40
+ return x > y ? true : false ;
41
+ }
42
+
43
+ bool pair_Compare (const pair<int , int >&a, const pair<int , int >&b)
44
+ {
45
+ return a.second < b.second ;
46
+ }
47
+
48
+ // Solution Class
49
+ class Solution {
50
+ public:
51
+ int utopianTree (int n){
52
+
53
+ int height = 1 ;
54
+ for (int i = 0 ; i < n; i++){
55
+ if (i & 1 )
56
+ height += 1 ;
57
+ else
58
+ height *= 2 ;
59
+ }
60
+ return height;
61
+ }
62
+ };
63
+
64
+ int main ()
65
+ {
66
+
67
+ // ONLINE_JUDGE
68
+ #ifndef rahulbordoloi
69
+ freopen (" input.txt" , " r" , stdin);
70
+ // freopen("output.txt", "w", stdin);
71
+ #endif
72
+
73
+ // Code
74
+ fast;
75
+ int tc;
76
+ cin>>tc;
77
+ int n;
78
+ while (tc--){
79
+ cin>>n;
80
+ cout<<Solution ().utopianTree (n)<<endl;
81
+ }
82
+
83
+ cerr<<" TIME : " <<(float )clock () / CLOCKS_PER_SEC<<" s" <<endl;
84
+ return 0 ;
85
+
86
+ }
0 commit comments