题解 | #记负均正II#

记负均正II

https://www.nowcoder.com/practice/64f6f222499c4c94b338e588592b6a62

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 nativeNum = 0
    let postiveNum = 0
    let postiveTotal = 0
    while(line = await readline()){
        let inputNum = Number(line)
        if (inputNum < 0) {
            nativeNum++
        } else {
            postiveNum++
            postiveTotal+=inputNum
        }
    }
    console.log(nativeNum)
    if (postiveNum > 0) {
        console.log((postiveTotal / postiveNum).toFixed(1))
    } else {
        console.log('0.0')
    }
}()

全部评论

相关推荐

舂锋:不能投什么岗都用一份简历,一般都是要看企业的岗位需求来写职业技能或者是项目经历,跟岗位相关的就写多一点。
点赞 评论 收藏
分享
白火同学:能。我当初应届沟通了1200,收简历50,面试10左右吧,加油投吧
投了多少份简历才上岸
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务