题解 | #高精度整数加法#
高精度整数加法
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 () {
// Write your code here
let str1 = await readline()
let str2 = await readline()
// 在ES6中提供了BigInt数据类型,方便我们进行大数据的运算
let num1 = BigInt(str1)
let num2 = BigInt(str2)
// 使用toString()方法是由于使用了BigInt之后,数据自身的结尾会携带一个n
console.log((num1 + num2).toString());
}();
在线编程题解 文章被收录于专栏
web技术
