-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSolution.java
More file actions
37 lines (29 loc) · 1.02 KB
/
Copy pathSolution.java
File metadata and controls
37 lines (29 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class Solution {
public static void main(String[] args)throws IOException {
/* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n, height = 1, cycles;
n = Integer.parseInt(br.readLine());
for (int i = 0; i < n; i ++) {
cycles = Integer.parseInt(br.readLine());
if (cycles == 0) {
height = 1;
} else {
for (int j = 0; j < cycles; j++) {
if (j % 2 == 0) {
height += height;
} else {
height += 1;
}
}
}
System.out.println(height);
height = 1;
}
}
}