#K35197. K-th Node in Level Order Traversal

    ID: 25478 Type: Default 1000ms 256MiB

K-th Node in Level Order Traversal

K-th Node in Level Order Traversal

In a complete binary tree, nodes are labeled consecutively starting from 1 in level order (i.e., from left to right, top to bottom). For a given integer ( k ), your task is to determine the value of the k-th node in this level order traversal. Essentially, since the tree is filled consecutively, the value of the k-th node is exactly ( k ).

Note: The input will be a single integer and you should output that integer as the result.

inputFormat

The input contains one integer. This integer ( k ) (( 1 \leq k \leq 10^9 )) represents the position (1-indexed) in the level order traversal of the binary tree.

outputFormat

Output a single integer representing the value of the k-th node in the binary tree's level order traversal. Since the node values are assigned consecutively, the answer is simply ( k ).## sample

1
1