2023 ๋ณด๋๊ฒ์์ปต์์ ๋์๋ ๋ฌธ์ ์ ๋๋ค.
์ ๋ ํด์ฌ๋ฅผ ์ด์ฉํด์ ๋ฌธ์ ๋ฅผ ํ์ด ๋ณด์์ต๋๋ค.
import java.util.HashMap;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Main T = new Main();
Scanner kb = new Scanner(System.in);
int n = kb.nextInt();
HashMap<String, Integer> map = new HashMap<>();
for (int i = 0; i < n; i++) {
String a = kb.next();
int b = kb.nextInt();
map.put(a, map.getOrDefault(a,0)+b);
}
String answer = "NO";
for (String key : map.keySet()) {
if(map.get(key)==5) answer ="YES";
}
System.out.println(answer);
}
}
'๐ป ๊ฐ๋ฐ๊ณต๋ถ > Algorithm' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[Eric's ๋ฐฑ์ค] 10809๋ฒ - ์ํ๋ฒณ์ฐพ๊ธฐ - Java (0) | 2023.01.26 |
---|---|
[Eric's ๋ฐฑ์ค] 3273๋ฒ - ๋ ์์ ํฉ - Java (0) | 2023.01.18 |
[Eric's ๋ฐฑ์ค] 1712๋ฒ - ์์ต๋ถ๊ธฐ์ - Java (0) | 2023.01.17 |
[Eric's ๋ฐฑ์ค] 1806๋ฒ - ๋ถ๋ถํฉ - Java (0) | 2023.01.16 |
[Eirc's ๋ฐฑ์ค] 1764๋ฒ - ๋ฃ๋ณด์ก - Java ์๊ณ ๋ฆฌ์ฆ (0) | 2023.01.15 |