Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $numOfBalls = intval(readline());
- $points = 0;
- $red = 0;
- $orange = 0;
- $yellow = 0;
- $white = 0;
- $black = 0;
- $other = 0;
- for($i=1; $i <= $numOfBalls;$i++){
- $ballColor = strtolower(readline());
- if($ballColor == "red"){
- $red++;
- $points += 5;
- }elseif ($ballColor == "orange"){
- $orange++;
- $points += 10;
- }elseif ($ballColor == "yellow"){
- $yellow++;
- $points += 15;
- }elseif ($ballColor == "white"){
- $white++;
- $points += 20;
- }elseif ($ballColor == "black"){
- $black++;
- $points /= 2;
- }else{
- $other ++;
- }
- }
- printf("Total points: %.0f\nPoints from red balls: %.0f\nPoints from orange balls: %.0f\nPoints from yellow balls: %.0f\nPoints from white balls: %.0f\nOther colors picked: %.0f\nDivides from black balls: %.0f",
- floor($points),$red,$orange,$yellow,$white,$other,$black);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement