Skip to content

Commit e5b9faf

Browse files
Merge pull request #682 from eric-hjh/main
[황장현] 103차 라이브 코테 제출
2 parents 7f06259 + c84ea43 commit e5b9faf

3 files changed

Lines changed: 32 additions & 0 deletions

File tree

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
const fs = require('fs');
2+
const input = fs
3+
.readFileSync(process.platform === 'linux' ? '/dev/stdin' : './input.txt')
4+
.toString()
5+
.trim();
6+
7+
function solution(input) {
8+
let N = input;
9+
let count = 0;
10+
11+
while (N >= 0) {
12+
if (N % 5 === 0) {
13+
count += N / 5;
14+
return count;
15+
}
16+
N -= 3;
17+
count++;
18+
}
19+
20+
return -1;
21+
}
22+
23+
console.log(solution(input));

live10/test103/문제2/황장현.js

Whitespace-only changes.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
function solution(n) {
2+
const dp = new Array(n + 1).fill(0);
3+
dp[1] = 1;
4+
dp[2] = 2;
5+
for (let i = 3; i <= n; i++) {
6+
dp[i] = (dp[i - 1] + dp[i - 2]) % 1000000007;
7+
}
8+
return dp[n];
9+
}

0 commit comments

Comments
 (0)