Programming Basics Online Exam - 9 and 10 March 2019
Здравейте, записах курса Programming Basics with PHP - март 2019 и сме все още в началото. Моля помогнете ми със задачата
02. Skeleton според мен кода ми е верен, но като го пусна в https://judge.softuni.bg/Contests/Practice/Index/1538#3 и казва, че е грешен.
Ето го и кода:
<?php
$minControl = intval(readline());
$secControl = intval(readline());
$widthUlei = floatval(readline());
$secNaMetri = intval(readline());
$controlVSec= $minControl * 60 + $secControl;
$vremeDecreases= $widthUlei/120;
$allDecreasesTime = $secNaMetri * 2.5;
$timeMarin = ($widthUlei / 100) * $secNaMetri - $allDecreasesTime;
$formatted = number_format($timeMarin, 3, ".", "");
if ($timeMarin <= $controlVSe){
echo "Marin Bangiev won an Olympic quota!".PHP_EOL."His time is $formatted.";
}else{
"No, Marin failed! He was " . ($timeMarin - $controlVSecundi) . "second slower.";
}
Много благодаря за отделеното време,успях да си оправя кода. Оказа се, че съм объркал изчислението на $allDecreasesTime и както каза колегата съм забравила echo в elsa.
Ето работещия код:
<?php
$minControl = intval(readline());
$secControl = intval(readline());
$widthUlei = floatval(readline());
$secNaMetri = intval(readline());
$controlVSec = $minControl * 60 + $secControl;
$vremeDecreases = $widthUlei / 120;
$allDecreasesTime = $vremeDecreases * 2.5;
$timeMarin = ($widthUlei / 100) * $secNaMetri - $allDecreasesTime;
$formatted = number_format($timeMarin, 3, ".", "");
if ($timeMarin <= $controlVSec){
echo "Marin Bangiev won an Olympic quota!" . PHP_EOL . "His time is $formatted.";
} else {
echo "No, Marin failed! He was " . round(($timeMarin - $controlVSec), 3 , PHP_ROUND_HALF_UP) . " second slower.";
}
Really appreciate you sharing this blog post.Much thanks again. Fantastic and waiting for more info WorldCup live TV Apk
test