V8
while (line = readline()) {
var lines = line.split(' ');
var a = parseInt(lines[0]);
var b = parseInt(lines[1]);
print(a + b);
}
Node
const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
let inputArr = [];
rl.on("line", function (input) {
let res = input.split(' ').map(i=>+i); // 获取此行数据
console.log(res[0]+res[1])
});
let number = parseInt(readline());
while(number--){
let line =readline();
let arr = line.split(' ');
let a = parseInt(arr[0]);
let b = parseInt(arr[1]);
print(a+b);
}
Node
const readline = require("readline");
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
let inputArr = [];
rl.on("line", function (input) {
inputArr.push(input.split(' ').map(Number)); // 获取此行数据
const nLine = parseInt(inputArr[0]); // 获取行数
if (inputArr.length == nLine+ 1) {
// 获取了此轮所有数据,此时获取元素 nLine+1 个,第一个元素为行数nLine.
const arr = inputArr.slice(1); // 除去行数的具体数据
arr.forEach(item=>{
console.log(item[0]+item[1])
})
inputArr = []; // 清空数组
rl.close();
}
});
V8
let line
while(line = readline()){
let arr = line.split(' ').map(item=>parseInt(item))
if(arr[0]!==0 && arr[1]!==0){
print(arr[0]+arr[1])
}
}
Node
const readline = require("readline");
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
let inputArr = [];
rl.on("line", function (input) {
let curinput=input.split(' ').map(Number)
inputArr.push(curinput); // 获取此行数据
const nLine = parseInt(inputArr[0]); // 获取行数
if(curinput[0]==0 && curinput[1]==0){
let arr= inputArr.slice(0,-1)
arr.forEach(item=>{
console.log(item[0]+item[1])
})
}
});
V8
while(line = readline())
{
let arr = line.split(' ').map(item=>parseInt(item))
if(arr[0]!==0){
let res = 0
for(i = 1;i<arr.length;i++){
res+=arr[i]
}
print(res)
}
}
Node
const readline = require("readline");
var rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
let inputArr1 = [];
rl.on("line", function (input) {
let curinput =input.split(' ').map(Number)
inputArr1.push(curinput); // 获取此行数据
// const nLine = parseInt(inputArr[0]); // 获取行数
function sum(arr){
return arr.reduce((acc,cur)=>acc+cur)
}
if (curinput.length==1 && curinput[0]==0) {
// 获取了此轮所有数据,此时获取元素 nLine+1 个,第一个元素为行数nLine.
const arr = inputArr1.slice(0,-1); // 除去行数的具体数据
arr.forEach(item=>{
console.log(sum(item.slice(1)))
})
inputArr1 = []; // 清空数组
rl.close();
}
});
V8
let number = parseInt(readline());
while(number--){
let line = readline();
let arr = line.split(' ').map(item=>parseInt(item));
let sum = 0;
for(let i = 1; i <= arr[0]; i++) {
sum += arr[i];
}
print(sum);
}
Node
const readline = require('readline')
const rl = readline.createInterface({
input: process.stdin,
output:process.stdout
});
const arr = [];
let n=-1;
let curLine =0;
rl.on('line', function(line){
if(n<0){
n = parseInt(line);
}else{
arr.push(line.split(' ').map(Number))
curLine++;
}
if(curLine === n){
for(let i=0; i<arr.length; ++i){
let ans =0;
for(let j =1; j<arr[i].length; ++j){
ans+= arr[i][j];
}
console.log(ans)
}
}
})
V8
while(line = readline())
{
let arr = line.split(' ').map(item=>parseInt(item))
let res = 0
for(i = 1;i<arr.length;i++){
res+=arr[i]
}
print(res)
}
Node
const readline = require('readline')
const rl = readline.createInterface({
input: process.stdin,
output:process.stdout
});
rl.on('line', function(line){
let arr = line.split(' ').map(Number);
//每行含义都相同时不需要push
//含义不同,有明确的停止条件时才用数组
let ans =0;
for(let i=1; i<arr.length;++i){
ans+= arr[i];
}
console.log(ans)
})
V8
while(line = readline())
{
let arr = line.split(' ').map(item=>parseInt(item))
let res = 0
for(i = 0;i<arr.length;i++){
res+=arr[i]
}
print(res)
}
Node
const readline = require('readline')
const rl = readline.createInterface({
input: process.stdin,
output:process.stdout
});
rl.on('line', function(line){
let arr = line.split(' ').map(Number);
//每行含义都相同时不需要push
//含义不同,有明确的停止条件时才用数组
let ans =0;
for(let i=0; i<arr.length;++i){
ans+= arr[i];
}
console.log(ans)
})
V8
Node
V8
while(line=readline()){
let arr=line.split(' ')
print(arr.sort().join(' '))
}
Node
const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
rl.on('line', function (line) {
let arr = line.split(' ').sort();
console.log(arr.join(' '));
});
V8
while(line=readline()){
if(line !== 'nowcoder') {
let arr=line.split(',')
print(arr.sort().join(','))
}
}
Node
const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
rl.on('line', function (line) {
if(line !== 'nowcoder'){
let arr = line.split(',').sort();
console.log(arr.join(','));
}
});
v8
while(line = readline()){
var lines = line.split(' ').map(Number)
console.log(lines[0] + lines[1])
}
V8
while(line=readline()){
let arr=line.split(' ')
print(Number(arr[0])+Number(arr[1]))
}
Node
const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
rl.on('line', function (line) {
let arr = line.split(' ').map(Number);
console.log(arr[0]+arr[1])
})