09. Padawan Equipment with PHP
09. Padawan Equipment with PHP - https://judge.softuni.bg/Contests/Compete/Index/1195#0
Ще бъда благодарен ако някой, който е решавал задачата вече, конкретно на PHP ми покаже кода си. Аз очевидно според джъдж някъде бъркам 70/100.
<?php
$money = floatval(readline());
$students = floatval(readline());
$priceLightsabers = floatval(readline());
$priceRobes = floatval(readline());
$priceBelts = floatval(readline());
$sumSabers = $priceLightsabers * ceil(($students + 0.10 * $students));
$sumRobes = $priceRobes * $students;
$sumBelts = $priceBelts * ceil($students - ($students / 6));
$sumAll = $sumSabers + $sumRobes + $sumBelts;
if ($sumAll <= $money) {
echo "The money is enough - it would cost " . number_format($sumAll, 2, '.', ' ') . "lv.";
} else {
$needMore = $sumAll - $money;
echo "Ivan Cho will need " . number_format($needMore, 2, '.', ' ') . "lv more.";
}
?>