题解 | 统计每个月兔子的总数
const rl = require("readline").createInterface({ input: process.stdin });
var iter = rl[Symbol.asyncIterator]();
const readline = async () => (await iter.next()).value;
void (async function () {
let n = parseInt(await readline());
let a = 1, b = 1, c = 1;
for (let i = 3; i <= n; i++) {
c = a + b;
a = b;
b = c;
}
console.log(c);
})();

字节跳动工作强度 1201人发布
查看3道真题和解析