1001. The (3N + 1) conjecture that the dead are not worth the candle (15) Time Limit 400 MS
Memory limit 32000 KB
CodeLength limit 8000 B
JudgementProgram Standard Author Chen, Yue
Callatz conjecture:
For any natural number N, if it is an even number, cut it by half; if it is an odd number, cut (3N + 1) by half. In this way, we will continue to cut down and finally get n = 1 in a certain step. Karaz announced this conjecture at the world mathematician conference in 1950. It is said that at that time, the teachers and students of Yale University were mobilized to prove this seemingly silly and naive proposition, and the results made the students unwilling to study, as a result, some people say this is a conspiracy. karaz is deliberately delaying the progress of teaching and scientific research in American mathematics ......
Today's question is not to prove caraz's conjecture, but to give a given positive integer n of no more than 1000, simply count it. How many steps (cut down) Do we need to get n = 1?
Input Format:Each test input contains one test case, that is, the value of natural number n.
Output Format:The number of steps required for the output from N to 1.
Input example:
3
Output example:
5
# include
using namespace STD; int main () {int K = 0; // int N for statistics; // CIN> N; while (n> 1) {If (N % 2) N = (N * 3 + 1); N/= 2; k ++;} cout
submit Code
View comments * the above comments only represent their personal opinions, does not represent the opinion or position of the csdn website