Pirate Ship II


Collapse Content

You're the captain of a pirate ship and would like to calculate the state of the ship. There are two parameters - gold and pirates.

If there's less gold than pirates, that's always bad. If there's at least as much gold as pirates, that's good (even though the gold cannot be divided equally). If the gold can be divided by the pirates equally, that's great. However, if gold + pirates > 100, that's always bad since the ship may sink. Return an int corresponding to the state of the ship, according to the following:

  • 0 - Bad
  • 1 - Good
  • 2 - Great

Input Note:
Boilerplate code is provided for Java. To solve this in another language, you just need to read in a list of number pairs from the standard input, where the first number is gold and the second number is pirates.

Challenge

What is the State of the Ship?

Please sign in or sign up to submit answers.

Alternatively, you can try out Learneroo before signing up.

Comments

Contact Us
Sign in or email us at [email protected]