Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $handle = fopen ("php://stdin","r");
- fscanf($handle,"%d",$n);
- $arr_temp = fgets($handle);
- $arr = explode(" ",$arr_temp);
- array_walk($arr,'intval');
- $pos = 0; $neg = 0; $null = 0;
- foreach($arr AS $key=>$value) {
- if ($value==0) {
- $null++;
- } elseif ($value>0) {
- $pos++;
- } else {
- $neg++;
- }
- }
- echo round($pos/$n,6)."\n";
- echo round($neg/$n,6)."\n";
- echo round($null/$n,6);
Advertisement
Add Comment
Please, Sign In to add comment