티스토리 뷰

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

//https://www.acmicpc.net/problem/24417
const N = +require('fs').readFileSync('./dev/stdin').toString().trim();
const MOD = 1_000_000_007;

let temp1 = 1;
let temp2 = 1;
let temp3 = 0;

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