Question: Snail - a Wall Climber Programming challenge description: A snail climbs on a wall, it starts at the bottom and climbs up nn meters a

Snail - a Wall Climber
Programming challenge description:
A snail climbs on a wall, it starts at the bottom and climbs up nn meters a day. Regretfully, every night it slides mm meters down.
Given the height of the wall HH, write a program to calculate how many days required for the snail to reach the top of the wall.
Input:
Three non-negative integers nn, mm, and HH separated by a space. For example:
3211
Output:
A single integer number, which is the number of days required for the snail to reach the top of the wall. For example:
9
If the snail will never be able to reach the top of the wall print Fail
Test 1
Test InputDownload Test 1 Input
3211
Expected OutputDownload Test 1 Output
9
Test 2
Test InputDownload Test 2 Input
529
Expected OutputDownload Test 2 Output
3
Test 3
Test InputDownload Test 3 Input
343
Expected OutputDownload Test 3 Output
1
Test 4
Test InputDownload Test 4 Input
003
Expected OutputDownload Test 4 Output
Fail

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!