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 | 31 |
Tags
- ํ๋ก๊ทธ๋๋จธ์ค ๊ฑฐ๋ฆฌ๋๊ธฐ ํ์ธํ๊ธฐ
- js
- TypeError: createContext only works in Client Components. Add the "use client" directive at the top of the file to use it. Read more:
- ๊ตฌ๋ฆํค ์ฑ๋ฆฐ์ง ํ๊ณ
- ๋ฐฑ์ค 2108 nodejs
- ๊ตฌ๋ฆํค ์ฑ๋ฆฐ์ง
- ๋ฐฑ์ค 1339๋ฒ js
- app router emotion
- ์ค์ฝํ
- suspense ๋น๋๊ธฐ
- js ์ค์ฝํ
- ์ต์ ๋์ฒด์ด๋
- next13 emotion
- ๋ฐฑ์ค 1339๋ฒ ์๋ฐ์คํฌ๋ฆฝํธ
- ์ฌ์ฉ์ฑ ๊ฐ์
- suspense react-query
- ์นด์นด์ค ์ฝํ
- ๊ตฌ๋ฆํค
- ์๋ฐ์คํฌ๋ฆฝํธ ์ค์ฝํ
- ๋ฆฌ์กํธ์ฟผ๋ฆฌ suspense
- emtion app router
- ์๋ฐ์คํฌ๋ฆฝํธ ๋ฌธ์์ด ์์ถ
- js ๋ฌธ์์ด ์์ถ
- ๋ฐฑ์ค 1339๋ฒ nodejs
- ํ๋ก๊ทธ๋๋จธ์ค ๋ฌธ์์ด ์์ถ
- suspense ๋์์๋ฆฌ
- suspense ๋ณ๋ชฉํ์
- js ๊ฑฐ๋ฆฌ๋๊ธฐ ํ์ธํ๊ธฐ
- ๋ฐฑ์ค 2108 ์๋ฐ์คํฌ๋ฆฝํธ
- emotion RSC
Archives
- Today
- Total
Lennon FE
[๋ฐฑ์ค 10610๋ฒ] 30 - ์๋ฐ์คํฌ๋ฆฝํธ(nodejs) ๋ณธ๋ฌธ
728x90
๋ฐ์ํ
https://www.acmicpc.net/problem/10610
const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
let input;
rl.on('line', function (line) {
input = line.split('').map(Number);
rl.close();
}).on('close', function () {
console.log(solution(input));
});
function solution(num) {
if (!num.includes(0)) {
return -1;
}
if (num.reduce((acc, cur) => acc + cur, 0) % 3 !== 0) {
return -1;
}
num = num.sort((a, b) => b - a);
return num.join('');
}
30์ ๋ฐฐ์๊ฐ ๋๋ ์กฐ๊ฑด์ ๋ ๊ฐ์ง์ด๋ค.
0์ด ์์ด์ผ ํ๊ณ , ๊ฐ ์๋ฆฟ์๋ฅผ ๋ํ ๊ฐ์ด 3์ด๋ ๋๋์ด ๋จ์ด์ ธ์ผ ํ๋ค.
์ด ๋ ๊ฐ๋ง ์ฒ๋ฆฌํด์ฃผ๋ฉด ์ฝ๊ฒ ๋ต์ ๊ตฌํ ์ ์๋ค. ๋ํ 10^5์๋ฆฌ ์๊น์ง ์ฃผ์ด์ง๊ธฐ ๋๋ฌธ์ ๋ฌธ์์ด๋ก ์ฒ๋ฆฌํด์ผ ์ถ๋ ฅ ์ด๊ณผ๋ฅผ ํผํ ์ ์๋ค.
728x90
๋ฐ์ํ
'๐ฅ Algorithm > Baekjoon' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[๋ฐฑ์ค 9935๋ฒ] ๋ฌธ์์ด ํญ๋ฐ - ์๋ฐ์คํฌ๋ฆฝํธ(nodejs) (0) | 2022.04.06 |
---|---|
[๋ฐฑ์ค 14490๋ฒ] ๋ฐฑ๋์ด - ์๋ฐ์คํฌ๋ฆฝํธ(nodejs) (0) | 2022.04.05 |
[๋ฐฑ์ค 11057๋ฒ] ์ค๋ฅด๋ง ์ - ์๋ฐ์คํฌ๋ฆฝํธ(nodejs) (0) | 2022.03.18 |
[๋ฐฑ์ค 1309๋ฒ] ๋๋ฌผ์ - ์๋ฐ์คํฌ๋ฆฝํธ(nodejs) (0) | 2022.03.18 |
[๋ฐฑ์ค 1260๋ฒ] DFS์ BFS - ์๋ฐ์คํฌ๋ฆฝํธ(nodejs) (0) | 2022.03.18 |
Comments