• 문제 링크
https://www.acmicpc.net/problem/34033
• 풀이 코드
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.HashMap;
import java.util.Map;
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));
Map<String, Integer> map = new HashMap<>();
Pair p = new Pair(br.readLine());
int n = Integer.parseInt(p.s), m = p.i;
while (n-- > 0) map.put((p = new Pair(br.readLine())).s, p.i);
int cnt = 0;
while (m-- > 0) if (map.get((p = new Pair(br.readLine())).s) * 1.05 < p.i) cnt++;
bw.write(String.valueOf(cnt));
bw.flush();
}
private static class Pair {
String s;
int i;
Pair(String s) {
int i = s.indexOf(' ');
this.s = s.substring(0, i);
this.i = Integer.parseInt(s.substring(i + 1));
}
}
}
'Problem Solving > Baekjoon' 카테고리의 다른 글
[백준] 30306 Better Dice - Brute Force / Java (0) | 2025.07.19 |
---|---|
[백준] 33691 Arkain 대시보드 - Data Structure / Java (0) | 2025.07.18 |
[백준] 25624 SNUPTI - Data Structure / Java (0) | 2025.07.16 |
[백준] 10981 HEADING TO WORLD FINALS - Data Structure / Java (0) | 2025.07.15 |
[백준] 27969 I LOVE JavaScript - Data Structure / Java (0) | 2025.07.14 |
댓글