Seize your moment! ๐Ÿ‘พ

์•ˆ๋…•ํ•˜์„ธ์š”. Eric์ž…๋‹ˆ๋‹ค. ์ œ ๋ธ”๋กœ๊ทธ์— ๋ฐฉ๋ฌธํ•ด์ฃผ์…”์„œ ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค.

๐Ÿ’ป ๊ฐœ๋ฐœ๊ณต๋ถ€/Algorithm

[Eric's ๋ฐฑ์ค€] 27160๋ฒˆ - ํ• ๋ฆฌ๊ฐˆ๋ฆฌ - Java - 2023๋ณด๋“œ๊ฒŒ์ž„์ปต

Eric_ko 2023. 1. 15. 10:55

 

 

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);
    }
}

Solved.ac ํ”„๋กœํ•„