UVa 371 - Ackermann Functions

371 - Ackermann Functions

 * http://icpcres.ecs.baylor.edu/onlinejudge/index.php?option=com_onlinejudge&Itemid=8&category=5&page=show_problem&problem=307

Summary
Follow the instructions for all the numbers in the given range and keep record of the largest cycle, there is nothing more to it than that. Bruteforce will do.

Explanation
A "follow the instructions" problem.

Gotchas

 * As with UVa 100, the first number may be greater than the second.
 * However, the output states that the lower and upper bounds must be printed in a certain order.

Input
1 20 35 55 0 0

Output
Between 1 and 20, 18 generates the longest sequence of 20 values. Between 35 and 55, 54 generates the longest sequence of 112 values.