Last active
December 24, 2015 14:59
-
-
Save magmastonealex/6816828 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
$troutcost = 1; | |
$pikecost = 2; | |
$piccost = 3; | |
$total = 2; | |
$totalposs = 0; | |
for($numt=0; $numt <= floor($total/$troutcost); $numt++){ | |
for($numpi=0; $numpi <= floor($total/$pikecost); $numpi++){ | |
for($numpic=0; $numpic <= floor($total/$piccost); $numpic++){ | |
$t = (($numt*$troutcost)+($numpi*$pikecost)+($numpic*$piccost)); | |
if((($numt*$troutcost)+($numpi*$pikecost)+($numpic*$piccost)) != $total){ | |
if(!($numt == 0 && $numpic == 0 && $numpi == 0)){ | |
echo "$numt Brown Trout, $numpi Northern Pike, $numpic Yellow Pickerel<br>"; | |
$totalposs++; | |
} | |
} | |
} | |
} | |
} | |
echo "Total Ways to Catch Fish: $totalposs" | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment