#L0008. 3N+1 判断奇偶数

3N+1 判断奇偶数

1. Description

Take an integer input and assign the value to variable num

  • if num is odd,assign 3 * num + 1 to num
  • if num is even,assign num divided by 2 to num

2. Input & Output

Input:

  • Use input() as input. Notice that the value you get from input() is a string
  • Refering code below to load multiple inputs
s = input().split(" ")

# 读取第一个输入,如果想要读入整数,就通过 int() 把它变成整数
input_1 = int(s[0])

# 读取第二个输入,不需要数字时,就保留字符串
input_2 = s[1]

Output:

  • Use print() for your output

Example

# Input: 
15
# Output: 
46
# Input: 
200
# Output: 
100