Created
November 7, 2017 18:13
-
-
Save dflima/13859b1f204c58bb5e2422e9df17b4d8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$handle = fopen ("php://stdin","r"); | |
fscanf($handle,"%d",$n); | |
$arr_temp = fgets($handle); | |
$arr = explode(" ",$arr_temp); | |
$arr = array_map('intval', $arr); | |
$count = count($arr); | |
$positive = count(array_filter($arr, function ($i) { return $i > 0; })) / $count; | |
$negative = count(array_filter($arr, function ($i) { return $i < 0; })) / $count; | |
$zeroes = count(array_filter($arr, function ($i) { return $i = 0; })) / $count; | |
printf("%f\n%f\n%f", $positive, $negative, $zeroes); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment