20250706 baekjoon
This commit is contained in:
parent
9d16f1b6b2
commit
5b749cfe76
5
code_study/Baekjoon/python/10816.py
Normal file
5
code_study/Baekjoon/python/10816.py
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
from collections import Counter
|
||||||
|
input()
|
||||||
|
count = Counter(input().split())
|
||||||
|
input()
|
||||||
|
print(' '.join(str(count[k]) for k in input().split()))
|
||||||
7
code_study/Baekjoon/ts/10816.ts
Normal file
7
code_study/Baekjoon/ts/10816.ts
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
const input: string[] = require("fs").readFileSync(0, "utf8").toString().trim().split("\n");
|
||||||
|
let counter: Map<number, number> = new Map<number, number>();
|
||||||
|
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);
|
||||||
14
code_study/Baekjoon/ts/11773.ts
Normal file
14
code_study/Baekjoon/ts/11773.ts
Normal file
@ -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));
|
||||||
Loading…
x
Reference in New Issue
Block a user