Advertisement
Guest User

Untitled

a guest
Apr 21st, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. <?php
  2.  
  3. $broiKozunaci = readline();
  4. $bestChef = '';
  5. $bestChefPoints = 0;
  6. for($i = 0; $i < $broiKozunaci; $i ++) {
  7. $currentPoints = 0;
  8. $gotvach = readline();
  9. while(($ocenka = readline()) !== 'Stop') {
  10. $currentPoints = $currentPoints + (int)$ocenka;
  11. }
  12. echo "$gotvach has $currentPoints points." . PHP_EOL;
  13. if ($currentPoints > $bestChefPoints) {
  14. $bestChefPoints = $currentPoints;
  15. $bestChef = $gotvach;
  16. echo "$gotvach is the new number 1!" . PHP_EOL;
  17. }
  18. }
  19.  
  20. echo $bestChef . " won competition with ". $bestChefPoints . " points!";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement