题解 | #取近似值#
取近似值
http://www.nowcoder.com/practice/3ab09737afb645cc82c35d56a5ce802a
const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
rl.on('line', function (line) {
let allNum=Number(line,10);
let intNum=parseInt(allNum);
let endNum=0
if(allNum-intNum>=0.5){
endNum=intNum+Math.ceil(allNum-intNum)
}else{
endNum=intNum+Math.floor(allNum-intNum)
}
console.log(endNum)
});