File tree Expand file tree Collapse file tree 1 file changed +49
-0
lines changed
Codeforces_Contests/Round_638_Div_2 Expand file tree Collapse file tree 1 file changed +49
-0
lines changed Original file line number Diff line number Diff line change
1
+ /* *************************************************************************
2
+ * $Id$
3
+ * File:
4
+ *
5
+ * Purpose:
6
+ *
7
+ * Author: Sanchit Gupta (CS19B071)
8
+ *
9
+ * Created:
10
+ *
11
+ * Last modified:
12
+ *
13
+ * Bugs:
14
+ *
15
+ * Change Log:
16
+ *
17
+ * While(!(succeed==try());
18
+ **************************************************************************/
19
+ #include < iostream>
20
+ #include < bits/stdc++.h>
21
+
22
+ using namespace std ;
23
+
24
+ int main ()
25
+ {
26
+ int t;
27
+ cin>>t;
28
+ while (t--)
29
+ {
30
+ long long int n;
31
+ cin>>n;
32
+ long long int sum1=0 ,sum2=0 ;
33
+ long long int current=2 ,i=1 ;
34
+ while (i<(n/2 ))
35
+ {
36
+ sum1=sum1+current;
37
+ current=current*2 ;
38
+ i++;
39
+ }
40
+ while (i<n)
41
+ {
42
+ sum2=sum2+current;
43
+ current=current*2 ;
44
+ i++;
45
+ }
46
+ sum1=sum1+current;
47
+ cout<<abs (sum1-sum2)<<endl;
48
+ }
49
+ }
You can’t perform that action at this time.
0 commit comments