贴道老Coding题目# JobHunting - 待字闺中a*82010-10-05 07:101 楼int n > 0while (n != 1){if Odd(n)n = 3 * n + 1;elsen = n / 2;}问这个程序对任意n是不是永远会终止?
P*72010-10-05 07:103 楼Yes, it will output 1. You can prove it mathematically.【在 a*******8 的大作中提到】: int n > 0: while (n != 1): {: if Odd(n): n = 3 * n + 1;: else: n = n / 2;: }: 问这个程序对任意n是不是永远会终止?
K*g2010-10-05 07:106 楼怎么证明?【在 P*******7 的大作中提到】: Yes, it will output 1. You can prove it mathematically.