#F. 归1(Weird Algorithm)

    Type: FileIO (weird) 1000ms 256MiB

归1(Weird Algorithm)

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.

Description

Consider an algorithm that takes as input a positive integer n. If n is even, thealgorithm divides it by two, and if m is odd, the algorithm multiplies it by threeand adds one. The algorithm repeats this, until m is one. For example, thesequence for n = 3 is as follows:

3105168421

Your task is to simulate the execution of the algorithm for a given value of n.

Format

Input

The only input line contains an integer n.

Output

Print a line that contains all values of n during the algorithm.

Samples

3
3 10 5 16 8 4 2 1

Limitation

  • 1n10^6
  • Time limit: 1.00 s
  • Memory limit: 512 MB

模拟算法

Not Claimed
Status
Done
Problem
8
Open Since
2024-9-21 0:00
Deadline
2024-9-28 23:59
Extension
24 hour(s)