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
- emtion app router
- TypeError: createContext only works in Client Components. Add the "use client" directive at the top of the file to use it. Read more:
- js ๊ฑฐ๋ฆฌ๋๊ธฐ ํ์ธํ๊ธฐ
- ๊ตฌ๋ฆํค ์ฑ๋ฆฐ์ง
- js
- ๋ฆฌ์กํธ์ฟผ๋ฆฌ suspense
- ์ฌ์ฉ์ฑ ๊ฐ์
- emotion RSC
- js ๋ฌธ์์ด ์์ถ
- ๊ตฌ๋ฆํค
- ๋ฐฑ์ค 1339๋ฒ nodejs
- js ์ค์ฝํ
- ์๋ฐ์คํฌ๋ฆฝํธ ๋ฌธ์์ด ์์ถ
- suspense ๋ณ๋ชฉํ์
- next13 emotion
- ์ค์ฝํ
- ๋ฐฑ์ค 2108 ์๋ฐ์คํฌ๋ฆฝํธ
- ์นด์นด์ค ์ฝํ
- ๋ฐฑ์ค 1339๋ฒ js
- ์๋ฐ์คํฌ๋ฆฝํธ ์ค์ฝํ
- ๋ฐฑ์ค 1339๋ฒ ์๋ฐ์คํฌ๋ฆฝํธ
- suspense ๋์์๋ฆฌ
- ํ๋ก๊ทธ๋๋จธ์ค ๋ฌธ์์ด ์์ถ
- ํ๋ก๊ทธ๋๋จธ์ค ๊ฑฐ๋ฆฌ๋๊ธฐ ํ์ธํ๊ธฐ
- suspense ๋น๋๊ธฐ
- suspense react-query
- ์ต์ ๋์ฒด์ด๋
- ๋ฐฑ์ค 2108 nodejs
- ๊ตฌ๋ฆํค ์ฑ๋ฆฐ์ง ํ๊ณ
- app router emotion
Archives
- Today
- Total
Lennon FE
[๋ฐฑ์ค 2775๋ฒ] ๋ถ๋ ํ์ฅ์ด ๋ ํ ์ผ - ์๋ฐ์คํฌ๋ฆฝํธ(nodejs) ๋ณธ๋ฌธ
๐ฅ Algorithm/Baekjoon
[๋ฐฑ์ค 2775๋ฒ] ๋ถ๋ ํ์ฅ์ด ๋ ํ ์ผ - ์๋ฐ์คํฌ๋ฆฝํธ(nodejs)
Lennon 2022. 1. 17. 06:25728x90
๋ฐ์ํ
https://www.acmicpc.net/problem/2775
const fs = require('fs');
let input = fs
.readFileSync('dev/stdin', 'utf-8')
.toString()
.trim()
.split('\n')
.map((v) => +v);
input.shift();
const value = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]];
let idx = 0;
while (value.length !== 15) {
let arr = [];
let count = 0;
for (let i = 0; i < 14; i++) {
count += value[idx][i];
arr.push(count);
}
value.push(arr);
idx++;
}
while (input.length !== 0) {
const first = input.shift();
const second = input.shift();
console.log(value[first][second - 1]);
}
์ฒซ ๋ฒ์งธ ์์ผ๋ฌธ์์ 15์ธต๊น์ง ๊ฐ๋ค์ ๋ชจ๋ value๊ฐ์ ์ ์ฅํ๋ค.
์ ๋ ฅ๊ฐ์ด 2 ๊ฒฝ์ฐ๋ฅผ ์ ๋ ฅํ ๊ฑฐ๋ผ๊ณ ์ฒซ ๋ฒ์งธ ์ ๋ ฅ์ ํ๊ณ (shift๋ก ์ ๊ฑฐ)
๋ ๊ฐ์ฉ ๋ฌถ์ฌ ์์ผ๋ฏ๋ก ๋ง์ง๋ง while๋ฌธ์ shift๋ฅผ ํ๋ฉด์ ๊ธธ์ด๊ฐ 0์ด ๋ ๋๊น์ง ๋ฐฐ์ด์์ ์ถ๋ ฅ์ ํ๋ค.
728x90
๋ฐ์ํ
'๐ฅ Algorithm > Baekjoon' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
Comments