/
BOJ_25495.java
32 lines (30 loc) · 888 Bytes
/
BOJ_25495.java
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
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Main {
private void solution() throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
int sum = 0;
int bf = 0;
int cnt = 1;
StringTokenizer st = new StringTokenizer(br.readLine());
while (n-->0) {
int cur = Integer.parseInt(st.nextToken());
if (cur != bf) {
cnt = 1;
bf = cur;
}
cnt*=2;
sum += cnt;
if (sum >= 100) {
sum = 0;
cnt = 1;
}
}
System.out.println(sum);
}
public static void main(String[] args) throws Exception {
new Main().solution();
}
}