Type: Default 1000ms 256MiB

角谷猜想

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

【题目描述】

谓角谷猜想,是指对于任意一个正整数,如果是奇数,则乘3加1,如果是偶数,则除以2,得到的结果再按照上述规则重复处理,最终总能够得到1。如,假定初始整数为5,计算过程分别为16、8、4、2、1。程序要求输入一个整数,将经过处理得到1的过程输出来。

【输入】

一个正整数N(N ≤ 2,000,000)。

【输出】

从输入整数到1的步骤,每一步为一行,每一部中描述计算过程。最后一行输出"End"。如果输入为1,直接输出"End"。

【输入样例】

5

【输出样例】

5*3+1=16
16/2=8
8/2=4
4/2=2
2/2=1
End

【提示】

no

【来源】

一本通在线评测

B班第三天测试

Not Attended
Status
Done
Rule
Ledo
Problem
13
Start at
2025-7-23 18:57
End at
2025-7-23 20:57
Duration
2 hour(s)
Host
Partic.
7