大数字问题使用 JavaScript 的 BigInt 类型解决。
const rl = require("readline").createInterface({ input: process.stdin }); var iter = rl[Symbol.asyncIterator](); const readline = async () => (await iter.next()).value; void async function () { // Write your code here function Solution(top){ let stepMemory = Array.from(new Array(top + 1).fill(1n)) for(let i = 2; i < top + 1; i++){ stepMemory[i] = BigInt(stepMemory[i - 1]) + BigInt(stepMemory[i - 2]) } return stepMemory[top].toString() } while(line = await readline()){ let tokens = line.split(' '); let a = parseInt(tokens[0]); console.log(Solution(a)); } }()