20250712-2 baekjoon
This commit is contained in:
parent
fe95a079e4
commit
e0e4b269b9
22
code_study/Baekjoon/java/_17219.java
Normal file
22
code_study/Baekjoon/java/_17219.java
Normal file
@ -0,0 +1,22 @@
|
||||
import java.util.*;
|
||||
|
||||
public class _17219 {
|
||||
public static void main(String[] args){
|
||||
Scanner sc = new Scanner(System.in);
|
||||
String[] num = sc.nextLine().split(" ");
|
||||
int N = Integer.parseInt(num[0]);
|
||||
int M = Integer.parseInt(num[1]);
|
||||
|
||||
Map<String, String> keychain = new HashMap<>();
|
||||
for(int i=0; i<N; i++){
|
||||
String[] str = sc.nextLine().split(" ");
|
||||
keychain.put(str[0],str[1]);
|
||||
}
|
||||
|
||||
for(int i=0; i<M; i++){
|
||||
System.out.println(keychain.get(sc.nextLine()));
|
||||
}
|
||||
|
||||
sc.close();
|
||||
}
|
||||
}
|
||||
11
code_study/Baekjoon/ts/17219.ts
Normal file
11
code_study/Baekjoon/ts/17219.ts
Normal file
@ -0,0 +1,11 @@
|
||||
export {};
|
||||
const input:string[] = require("fs").readFileSync(0, "utf8").toString().trim().split('\n');
|
||||
const [N, M] = input[0].split(" ").map(Number);
|
||||
const keychain = new Map<string, string>();
|
||||
input.slice(1,N+1).forEach(v => {
|
||||
const [a,b] = v.split(' ');
|
||||
keychain.set(a,b);
|
||||
});
|
||||
input.slice(N+1).forEach(v=>{
|
||||
console.log(keychain.get(v));
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user