• 문제 링크
https://www.acmicpc.net/problem/25757
• 풀이 코드
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.HashSet;
import java.util.Set;
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));
Set<String> set = new HashSet<>();
String s = br.readLine();
int n = Integer.parseInt(s.substring(0, s.indexOf(' ')));
while (n-- > 0) set.add(br.readLine());
bw.write(String.valueOf(set.size() / divisor(s.charAt(s.length() - 1))));
bw.flush();
}
private static int divisor(char c) {
return c == 'Y' ? 1 : c == 'F' ? 2 : 3;
}
}'Problem Solving > Baekjoon' 카테고리의 다른 글
| [백준] 14184 IOI 2017 Logo - Data Structure / Java (0) | 2025.12.22 |
|---|---|
| [백준] 34635 Art Installation - Greedy / Java (0) | 2025.12.21 |
| [백준] 3211 kino - Greedy / Java (0) | 2025.12.20 |
| [백준] 7274 Liftas - Greedy / Java (0) | 2025.12.19 |
| [백준] 31307 Lines Per Hour - Greedy / Java (0) | 2025.12.18 |
댓글