Skip to content

Latest commit

 

History

History

zig-zag-camel

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

A camel at the base of a large sand dune wants to get to the top of it to see what is on the other side.

The dune distance d and height h are as shown below:


                              ....+
                          ........|      
                      ............|             
                  ................| h
              ....................|
          ........................|
Camel ----------------------------+
                    d

Steep dunes don't worry him because this is a smart camel!

When the slope is > 30 degrees, then instead of going straight up he will zig-zag back and forth so the climb is not so steep.

Task

Given d and h then what is the shortest amount of walking for our smart camel to get to the top of the sand dune?