[BOJ] 7567 그릇

Time Lapse :2min 3sec

7567.java

1
2
3
4
5
6
7
8
9
10
11
12
13
14
import java.io.*;

public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
String plate = br.readLine();
int ans = 10;
for(int i = 1; i < plate.length(); ++i)
ans += plate.charAt(i - 1) == plate.charAt(i) ? 5 : 10;
bw.write(Integer.toString(ans));
bw.flush();
}
}
Author: Song Hayoung
Link: https://songhayoung.github.io/2020/07/30/PS/BOJ/7567/
Copyright Notice: All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.