UVa 100 - The 3n + 1 problem

100 - The 3n + 1 problem

 * http://acm.uva.es/p/v1/100.html

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.

Even with no optimizations, one can pass the judge's tests with more than enough time. The relatively low acceptance rate comes from the fact that it's usually the first problem people attempt - people who are unfamiliar with the system. The Gotcha is a good one - it teaches you never to make assumptions about programming contest problems.

Gotcha's

 * j can be smaller than i.
 * The order of i and j in output must be the same as the input, even when j is smaller than i.

Input
1 10 100 200 201 210 900 1000 1000 900

Output
1 10 20 100 200 125 201 210 89 900 1000 174 1000 900 174