逻辑题,看看你的逻辑思想是否成熟?请用JAVA写出

total = 0;money = 10;bottle =0;cap = 0;while(money \u0026gt;=2 or bottle \u0026gt;=2 or cap \u0026gt;= 4){buy = money / 2 + bottle / 2 + cap / 4;total += buy;money = money mod 2;bottle = bottle mod 2 + buy;cap = cap mod 4 + buy;}print total;如果可以借空瓶子和瓶盖的话:total = 0;money = 10;bottle =0;cap = 0;while(money \u0026gt;=2 or bottle \u0026gt;= 1 or cap \u0026gt;= 3){borrowBottle = false;borrowCap =false;if money \u0026lt;=1 and bottle = 1 and cap \u0026lt;= 3 then{bottle += 1;borrowBottle = true;}else if money \u0026lt;= 1 and bottle = 0 and cap = 3 then{cap +=1;borrowCap = true;}buy = money / 2 + bottle / 2 + cap / 4;total += buy;money = money mod 2;bottle = bottle mod 2 + buy;cap = cap mod 4 + buy;if borrowBottle then{bottle -= 1;}if borrowCap then{cap -=1;}}print total;爪机无力排版请别拍砖。
■网友
逻辑题为何非要用JAVA写呢?


    推荐阅读