🐣 알고리즘 삐약/💻 백준 삐약

103 삐약 : 백준 17219 | 비밀번호 찾기 [바킹독| HASH |JAVA]

우주수첩 2024. 10. 31. 16:30
728x90

https://www.acmicpc.net/problem/17219

 

package BKD_0x15_Hash;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Iterator;
import java.util.StringTokenizer;

public class BOJ_17219 {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        HashMap<String,String> map = new HashMap<>();
        StringTokenizer st = new StringTokenizer(br.readLine());
        int N = Integer.parseInt(st.nextToken());
        int M = Integer.parseInt(st.nextToken());

        for(int i=0;i<N;i++){
            String[] input = br.readLine().split(" ");
            map.put(input[0],input[1]);
        }

        for(int i=0;i<M;i++){
            System.out.println(map.get(br.readLine()));
        }
    }
}

 

  • Hash<String,String>으로 EEEEEEEEEEEEEEEZ하게 해결

 

 

728x90