题解 | #高精度整数加法#
高精度整数加法
https://www.nowcoder.com/practice/49e772ab08994a96980f9618892e55b6
const rl = require("readline").createInterface({ input: process.stdin }); var iter = rl[Symbol.asyncIterator](); const readline = async () => (await iter.next()).value; void async function () { const a = await readline(); const b = await readline(); let i = a.length-1,j = b.length-1,carry = 0,res =""; while(i>=0 || j>=0 || carry>0){ const value = (i >= 0?a.charAt(i--)-0:0) + (j >= 0?b.charAt(j--)-0:0) + carry; res = (value%10) + res; carry = parseInt(value/10); } console.log(res||0); }()