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
38
39
40
41
42
43
44
45
46
47
48
49
|
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(in.readLine());
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
String arr;
int i;
arr = st.nextToken();
int len = arr.length();
int hap = 10;
for (i = 1; i < len; i++) {
if (arr.charAt(i) == '(') {
if (arr.charAt(i - 1) == ')') {
hap = hap + 10;
}
else {
hap = hap + 5;
}
}
else {
if (arr.charAt(i - 1) == ')') {
hap = hap + 5;
}
if (arr.charAt(i - 1) == '(') {
hap = hap + 10;
}
}
}
bw.write(String.format("%d", hap));
bw.flush();
}
}
|
cs |
http://www.jungol.co.kr/bbs/board.php?bo_table=pbank&wr_id=1865&sca=2050
'정올문제소스코드' 카테고리의 다른 글
2857 : 세로읽기 (0) | 2021.08.11 |
---|---|
2514 : 문자열 찾기 (0) | 2021.08.11 |
1740 : 소수 (0) | 2021.08.11 |
2811 : 소수와 합성수 (0) | 2021.07.26 |
1009 : 각 자리수의 역과 합(Number Reverse) (0) | 2021.07.19 |