Type: Default 1000ms 256MiB

归1

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.

题目描述

考虑一个以正整数作为输入的算法n。 如果nnn是偶数,算法将其除以二,如果n为奇数,算法将其乘以 3 并加 1。算法重复此操作,直到nnn是一。例如,n=3如下:

31051684213→10→5→16→8→4→2→1

你的任务是模拟给定一个值的算法的执行n。

输入

唯一的输入行包含一个整数n。

输出

打印包含所有值的行n在算法过程中。

约束

1n1061≤n≤10^6

例子

3
3 10 5 16 8 4 2 1

卓越班-Day02测试

Not Attended
Status
Done
Rule
ACM/ICPC
Problem
5
Start at
2024-7-22 9:00
End at
2024-7-22 10:00
Duration
1 hour(s)
Host
Partic.
0