# Problem 1277. How many days does the cat take to climb out of the hole?

A cat accidentally falls down a hole with sloping but rough sides. It can climb out of the hole of height h metres, but for every m metres it jumps, it falls back n metres where m is always bigger than n. It can only do one jump attempt per day and it is assumed that there is a small water source available to sustain it along the way.:) That said, how many days does it require to escape the hole?

NB: the cat must be clear of the hole or above it to escape so reaching exactly level with the hole opening it will still fall back down n metres.

HINT: once the cat is clear of the hole with its last jump it will not fall back into the hole.

EX: >> h = 20; m = 5; n = 3;

>> catdays(20,5,3)

ans = 9

### Solution Stats

49.73% Correct | 50.27% Incorrect
Last Solution submitted on Oct 18, 2023

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!