728x90

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

 

10816번: 숫자 카드 2

첫째 줄에 상근이가 가지고 있는 숫자 카드의 개수 N(1 ≤ N ≤ 500,000)이 주어진다. 둘째 줄에는 숫자 카드에 적혀있는 정수가 주어진다. 숫자 카드에 적혀있는 수는 -10,000,000보다 크거나 같고, 10,

www.acmicpc.net

const fs = require('fs');
const input = fs.readFileSync('/dev/stdin').toString().split("\n");
const dic = {};
const N = Number(input[0]);
const M = Number(input[2]);
const sang = input[1].split(" ");
const comp = input[3].split(" ");
const answer = [];


sang.forEach(d => {
    if(dic[d] === undefined) dic[d] = 1;
    else dic[d] ++;
});

comp.forEach((d) => {
    if(dic[d] !== undefined ) answer.push(dic[d]);
    else answer.push(0);
})

console.log(answer.join(" "));
728x90

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

 

10815번: 숫자 카드

첫째 줄에 상근이가 가지고 있는 숫자 카드의 개수 N(1 ≤ N ≤ 500,000)이 주어진다. 둘째 줄에는 숫자 카드에 적혀있는 정수가 주어진다. 숫자 카드에 적혀있는 수는 -10,000,000보다 크거나 같고, 10,

www.acmicpc.net

const fs = require('fs');
const input = fs.readFileSync('/dev/stdin').toString().split("\n");
const dic = {};
const N = Number(input[0]);
const M = Number(input[2]);
const sang = input[1].split(" ");
const comp = input[3].split(" ");
const answer = [];


sang.forEach(c => {
    dic[c] = 0;
});

comp.forEach((d) => {
    if(dic[d] !== undefined ) answer.push(1);
    else answer.push(0);
})

console.log(answer.join(" "));
728x90

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

 

14425번: 문자열 집합

첫째 줄에 문자열의 개수 N과 M (1 ≤ N ≤ 10,000, 1 ≤ M ≤ 10,000)이 주어진다.  다음 N개의 줄에는 집합 S에 포함되어 있는 문자열들이 주어진다. 다음 M개의 줄에는 검사해야 하는 문자열들이 주어

www.acmicpc.net

const fs = require('fs');
const input = fs.readFileSync('/dev/stdin').toString().trim().split("\n");

const [N, M] = input[0].split(" ").map(i => Number(i));
const dic = {};
let result = 0;

for(let i = 1 ; i <= N ; i++) {
    if (dic[input[i]] === undefined) {
        dic[input[i]] = 0;
    }
}


for(let i = N+1 ; i < N+1+M ; i++) {
    if (dic[input[i]] !== undefined) {
        result++;
    }
}

console.log(result);
728x90

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

 

1436번: 영화감독 숌

666은 종말을 나타내는 수라고 한다. 따라서, 많은 블록버스터 영화에서는 666이 들어간 제목을 많이 사용한다. 영화감독 숌은 세상의 종말 이라는 시리즈 영화의 감독이다. 조지 루카스는 스타워

www.acmicpc.net

const fs = require('fs');
const input = fs.readFileSync('/dev/stdin').toString().trim();

const N = Number(input);
let num = 666;
let n = 0;
while(true) {
    if(num.toString().includes('666')) {
        n+=1;
    }

    if(n === N) break;
    else num +=1;
}

console.log(num);

+ Recent posts