Harsh conditions
A group of hikers takes on a journey to climb one of the highest mountains. To be able to make it to the top, each of them needs to have appropriate equipment.
Our task is to tell if a specific person would make it to the top.
A hiker makes it to the top if any of these conditions hold:
- The person has
hiking shoes
and acoat
- The person has
hiking shoes
and atent
- The person has
hiking sticks
, acoat
, andsunglasses
.
The input consists of 3 essential belongings the person has.
The program should output
Yes
if the person would make it to the top and No
otherwise.Input | Output |
hiking shoes
coat
tent | Yes |
sunglasses
jacket
coat | No |
Hint 1
Can you think of a smart way of finding out if a person has a specific item -
hiking shoes
, coat
, sunglasses
, or a tent
? This will help you write less code and have a cleaner solution.Hint 2
You can first go over all the 3 inputs and check if any of those are, for example,
hiking shoes
. If you find that any of the inputs are hiking shoes
, you can set a boolean variable to True
(which was set to False
initially). You can perform the same procedure for sunglasses
, tent
, etc.Constraints
Time limit: 2 seconds
Memory limit: 512 MB
Output limit: 1 MB