题解 | #汽水瓶#
汽水瓶
https://www.nowcoder.com/practice/fe298c55694f4ed39e256170ff2c205f
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 lines = [] while(line = await readline()){ if(line!=='0'){ lines.push(line) }else{ getMax(lines) } } }() function getMax(lines){ lines = lines.map(Number) let result = [] for(let i =0 ;i<lines.length;i++){ result[i] = parseInt(lines[i]/2) } result.forEach(item=>{ console.log(item) }) }