Ładowanie...
Ładowanie...
Node.js 18 - JavaScript po stronie serwera
Wersja: Node.js 18 (Alpine Linux)
Wszystkie wbudowane moduły Node.js są dostępne:
// Rozwiązanie zadania
const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
const lines = [];
rl.on('line', (line) => {
lines.push(line);
});
rl.on('close', () => {
const n = parseInt(lines[0]);
const items = lines[1].split(' ').map(Number);
const result = items.reduce((a, b) => a + b, 0);
console.log(result);
});