const A = food => {if(food[0] >= 8) {food[0] -= 8;return true;}return false} const B = food => {if(food[1] >= 5) {food[1] -= 5;return true;}return false} const C = food => {if(food[2] >= 7) {food[2] -= 7;return true;}return false} const eat = [A,B,C,C,A,A,B] inputs.forEach(input => { let count = 0,day = 1 while(eat[day-1](input)) { count++ day++ if(day > 7) day = 1 } console.log(count) })
点赞 2

相关推荐

11-11 16:40
已编辑
门头沟学院 人工智能
不知道怎么取名字_:这个有点不合理了,相当于已经毕业了,但还是没转正,这不就是白嫖
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务