diff --git a/code_study/Baekjoon/python/10816.py b/code_study/Baekjoon/python/10816.py new file mode 100644 index 0000000..bddfe60 --- /dev/null +++ b/code_study/Baekjoon/python/10816.py @@ -0,0 +1,5 @@ +from collections import Counter +input() +count = Counter(input().split()) +input() +print(' '.join(str(count[k]) for k in input().split())) \ No newline at end of file diff --git a/code_study/Baekjoon/ts/10816.ts b/code_study/Baekjoon/ts/10816.ts new file mode 100644 index 0000000..f4bd673 --- /dev/null +++ b/code_study/Baekjoon/ts/10816.ts @@ -0,0 +1,7 @@ +const input: string[] = require("fs").readFileSync(0, "utf8").toString().trim().split("\n"); +let counter: Map = new Map(); +for(let n of input[1].split(" ").map(Number)){ + counter.set(n,(counter.get(n) || 0) + 1); +} +const result: string = input[3].split(" ").map(Number).map(n => counter.get(n) || 0).join(" "); +console.log(result); \ No newline at end of file diff --git a/code_study/Baekjoon/ts/11773.ts b/code_study/Baekjoon/ts/11773.ts new file mode 100644 index 0000000..ebf8ff3 --- /dev/null +++ b/code_study/Baekjoon/ts/11773.ts @@ -0,0 +1,14 @@ +export {} +const input:number[] = require("fs").readFileSync(0,"utf8").toString().trim().split('\n').map(Number); +let stack:number[] = []; +input.forEach((v,i) => { + if(i!==0){ + if(v===0){ + stack.pop(); + } + else { + stack.push(v); + } + } +}); +console.log(stack.reduce((acc,v) => acc + v, 0)); \ No newline at end of file