当前位置 : 主页 > 网络编程 > PHP >

how_much_beer.php

来源:互联网 收集:自由互联 发布时间:2021-06-28
how_much_beer.php = $beer) { $total_money -= $beer; } elseif ($bottle_num = ($beer/$bottle)) { $bottle_num -= ($beer/$bottle); } elseif ($cap_num = ($beer/$cap)) { $cap_num -= ($beer/$cap); } $bottle_num++; $cap_num++; $num++; echo 'Money:'
how_much_beer.php
 = $beer) {
        $total_money -= $beer;
    } elseif ($bottle_num >= ($beer/$bottle)) {
        $bottle_num -= ($beer/$bottle);
    } elseif ($cap_num >= ($beer/$cap)) {
        $cap_num -= ($beer/$cap);
    }

    $bottle_num++;
    $cap_num++;
    $num++;

    echo 'Money:' . ($total_money/10) . ' Bottle(s): ' . $bottle_num;
    echo ' Cap(s): '. $cap_num . " ----> Beers: " . $num . '';
    
    if($total_money<2 AND $bottle_num<2 AND $cap_num<4) break;
}

echo 'Result beer number: ' . $num . ' Bottle: ' . $bottle_num . ' Cap: ' . $cap_num;
网友评论