Skip to content

Commit 8b4c1fb

Browse files
committed
Added 1348A - Phoenix and Balance.cpp
1 parent 3e1b301 commit 8b4c1fb

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

1348A - Phoenix and Balance.cpp

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// ॐ नमः शिवाय
2+
#include<bits/stdc++.h>
3+
using namespace std;
4+
#define ll long long
5+
6+
// Code Written By: Vikash Patel
7+
// Codeforces Profile: https://codeforces.com/profile/vikashpatel
8+
9+
int main()
10+
{
11+
int t;
12+
cin>>t;
13+
while(t--)
14+
{
15+
int n;
16+
cin>>n;
17+
int lp = 0;
18+
for(int i=n/2; i<n; i++)
19+
{
20+
lp += pow(2,i);
21+
}
22+
int rp = pow(2,n);
23+
for(int i=1; i<n/2; i++)
24+
{
25+
rp += pow(2,i);
26+
}
27+
cout<<abs(lp-rp)<<endl;
28+
}
29+
return 0;
30+
}

0 commit comments

Comments
 (0)