UVa 10611 - The Playboy Chimp

Hints
Use binary search.