UVa 694 - The Collatz Sequence

694 - The Collatz Sequence

 * http://icpcres.ecs.baylor.edu/onlinejudge/index.php?option=com_onlinejudge&page=show_problem&problem=635

Explanation
A "follow the instructions" problem. See also UVa 100

Input
3 100 34 100 75 250 27 2147483647 101 304 101 303 -1 -1

Output
Case 1: A = 3, limit = 100, number of terms = 8 Case 2: A = 34, limit = 100, number of terms = 14 Case 3: A = 75, limit = 250, number of terms = 3 Case 4: A = 27, limit = 2147483647, number of terms = 112 Case 5: A = 101, limit = 304, number of terms = 26 Case 6: A = 101, limit = 303, number of terms = 1