题解 | #扭蛋机#

扭蛋机

http://www.nowcoder.com/practice/9d26441a396242a9a0f7d2106fc130c7

var n=parseInt(line)//返回数字
var res='';
while(n>0){
    if((n/2)>Math.floor(n/2)){
        n=(n-1)/2;
        res='2'+res;
    }
    else{
        n=(n-2)/2;
        res='3'+res;
    }
}
print(res)

全部评论

相关推荐

我的名字是句号:接好运
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务