Advertisement
Guest User

SoftUni - Raindrops - PHP - DvDty

a guest
Apr 14th, 2018
261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.41 KB | None | 0 0
  1. <?php
  2.  
  3. $amountOfRegions = intval(readline());
  4.  
  5. $density = floatval(readline());
  6.  
  7. $regionalCoefficientsSum = 0.000;
  8.  
  9. while ($amountOfRegions--) {
  10.     $input = explode(" ", readline());
  11.     $raindropsCount = intval($input[0]);
  12.     $squareMeters = intval($input[1]);
  13.  
  14.     $regionalCoefficientsSum += $raindropsCount / $squareMeters;
  15. }
  16.  
  17. echo number_format($regionalCoefficientsSum / ($density ? $density : 1), 3, '.', '');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement