Async Add Three
JavaScript
Easy
3 views
Problem Description
Given three integers a b c, return their sum using async function add(). Print sum.
Input Format
One line: a b c.
Output Format
One integer.
Constraints
Values fit in 64-bit.
Official Solution
const fs=require('fs');const p=fs.readFileSync(0,'utf8').trim().split(/\\s+/);if(!p[0])process.exit(0);const a=BigInt(p[0]),b=BigInt(p[1]),c=BigInt(p[2]);const add=async (x,y)=>{await Promise.resolve();return x+y;};(async()=>{let s=await add(a,b);s=await add(s,c);process.stdout.write(s.toString());})();
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!