题解 | #杨辉三角的变形#

杨辉三角的变形

https://www.nowcoder.com/practice/8ef655edf42d4e08b44be4d777edbf43

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
    while(n = await readline()){
        if (n<=2) {
            console.log(-1)
        } else if (n % 4 == 0) {
            console.log(3)
        } else if (n % 4 == 1 || n % 4 == 3) {
            console.log(2)
        } else if (n % 2 == 0) {
            console.log(4)
        }
    }
}()

全部评论

相关推荐

移动信息技术中心 金种子 50+n w
点赞 评论 收藏
转发
点赞 收藏 评论
分享
牛客网
牛客企业服务