티스토리 뷰

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

//https://www.acmicpc.net/problem/17175
const N = +require('fs').readFileSync('./dev/stdin').toString();
if (N < 2) {
	console.log(1);
	process.exit();
}

const MOD = 1_000_000_007;
let temp1 = 1;
let temp2 = 1;
let temp3;
for (let i = 2; i <= N; i++) {
	temp3 = (temp1 + temp2 + 1) % MOD;
	temp1 = temp2;
	temp2 = temp3;
}
console.log(temp3);
728x90
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2025/01   »
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
글 보관함