list($x, $y, $dummy) = explode(",", $strStdin, 3); $arrDataset[] = array("x" => floatval($x), "y" => floatval($y)); } // get the number of datasets $maxN = $arrDataset[0]["x"]; // remove the first element from the array array_splice($arrDataset, 0, 1); // remove the last element from the array array_pop($arrDataset); reset($arrDataset); if (0 < $maxN) { for ($i = 0; $i <= $maxN - 2; $i++) { $wkAns = 1; for ($j = $i + 1; $j <= $maxN - 1; $j++) { $dist = new dist(); $dist->setCenterPointA($arrDataset[$i]["x"], $arrDataset[$i]["y"]); $dist->setCenterPointB($arrDataset[$j]["x"], $arrDataset[$j]["y"]); if (NUM_DIST >= $dist->getDist()) { $wkAns++; } } if ($wkAns > $ans) { $ans = $wkAns; } } } else { $ans = 0; } // output answer to stdout fwrite(STDOUT, "Ans:" . $ans . PHP_EOL); class dist