Notice
Recent Posts
Recent Comments
Link
์ผ | ์ | ํ | ์ | ๋ชฉ | ๊ธ | ํ |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
Tags
- suspense ๋์์๋ฆฌ
- ์นด์นด์ค ์ฝํ
- suspense ๋ณ๋ชฉํ์
- ํ๋ก๊ทธ๋๋จธ์ค ๋ฌธ์์ด ์์ถ
- ์ต์ ๋์ฒด์ด๋
- ํ๋ก๊ทธ๋๋จธ์ค ๊ฑฐ๋ฆฌ๋๊ธฐ ํ์ธํ๊ธฐ
- js ์ค์ฝํ
- ๋ฐฑ์ค 1339๋ฒ ์๋ฐ์คํฌ๋ฆฝํธ
- js
- next13 emotion
- ๊ตฌ๋ฆํค ์ฑ๋ฆฐ์ง
- ๋ฐฑ์ค 2108 ์๋ฐ์คํฌ๋ฆฝํธ
- ๋ฆฌ์กํธ์ฟผ๋ฆฌ suspense
- TypeError: createContext only works in Client Components. Add the "use client" directive at the top of the file to use it. Read more:
- emtion app router
- ๊ตฌ๋ฆํค
- ๊ตฌ๋ฆํค ์ฑ๋ฆฐ์ง ํ๊ณ
- ๋ฐฑ์ค 2108 nodejs
- ์ฌ์ฉ์ฑ ๊ฐ์
- app router emotion
- emotion RSC
- ๋ฐฑ์ค 1339๋ฒ nodejs
- suspense ๋น๋๊ธฐ
- ์๋ฐ์คํฌ๋ฆฝํธ ๋ฌธ์์ด ์์ถ
- ๋ฐฑ์ค 1339๋ฒ js
- ์ค์ฝํ
- suspense react-query
- js ๋ฌธ์์ด ์์ถ
- js ๊ฑฐ๋ฆฌ๋๊ธฐ ํ์ธํ๊ธฐ
- ์๋ฐ์คํฌ๋ฆฝํธ ์ค์ฝํ
Archives
- Today
- Total
Lennon FE
[๋ฐฑ์ค 1759๋ฒ] ์ํธ ๋ง๋ค๊ธฐ - ์๋ฐ์คํฌ๋ฆฝํธ(nodejs) ๋ณธ๋ฌธ
๐ฅ Algorithm/Baekjoon
[๋ฐฑ์ค 1759๋ฒ] ์ํธ ๋ง๋ค๊ธฐ - ์๋ฐ์คํฌ๋ฆฝํธ(nodejs)
Lennon 2022. 5. 2. 12:59728x90
๋ฐ์ํ
https://www.acmicpc.net/problem/1759
const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
let input = [];
rl.on('line', function (line) {
input.push(line);
if (input.length === 2) {
rl.close();
}
}).on('close', function () {
const collection = ['a', 'e', 'i', 'o', 'u'];
const [L, C] = input[0].split(' ').map(Number);
const solution = input[1].split(' ').sort();
const combinationResult = getCombinations(solution, L);
const answer = combinationResult
.filter((v) => {
const collectionLength = v.filter((ele) => collection.includes(ele)).length;
const consonantLength = L - collectionLength;
if (collectionLength >= 1 && consonantLength >= 2) {
return v;
}
})
.map((v) => v.join(''));
console.log(answer.join('\n'));
});
const getCombinations = function (arr, selectNum) {
const results = [];
if (selectNum === 1) return arr.map((value) => [value]);
arr.forEach((fixed, index) => {
const rest = arr.slice(index + 1);
const combinations = getCombinations(rest, selectNum - 1);
const attached = combinations.map((combination) => [fixed, ...combination]);
results.push(...attached);
});
return results;
};
์ฃผ์ด์ง ๋ด์ฉ๋๋ก ์ ๋ ฌ ๋ฐ ์กฐํฉํ๊ณ , ๋ชจ์, ์์ ํํฐ๋ง๋ง ๊ฑฐ์ณ์ฃผ๋ฉด ์ฝ๊ฒ ํ ์ ์๋ค.
728x90
๋ฐ์ํ
'๐ฅ Algorithm > Baekjoon' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[๋ฐฑ์ค 14612๋ฒ] ๊น์๋น - ์๋ฐ์คํฌ๋ฆฝํธ(nodejs) (0) | 2022.05.05 |
---|---|
[๋ฐฑ์ค 2108๋ฒ] ํต๊ณํ - ์๋ฐ์คํฌ๋ฆฝํธ(nodejs) (0) | 2022.05.03 |
[๋ฐฑ์ค 14503๋ฒ] ๋ก๋ด์ฒญ์๊ธฐ - ์๋ฐ์คํฌ๋ฆฝํธ(nodejs) (0) | 2022.04.30 |
[๋ฐฑ์ค 9935๋ฒ] ๋ฌธ์์ด ํญ๋ฐ - ์๋ฐ์คํฌ๋ฆฝํธ(nodejs) (0) | 2022.04.06 |
[๋ฐฑ์ค 14490๋ฒ] ๋ฐฑ๋์ด - ์๋ฐ์คํฌ๋ฆฝํธ(nodejs) (0) | 2022.04.05 |
Comments