P9748 [CSP-J 2023] Small Apples
Description
There are $n$ apples on Little Y’s desk, arranged in a row from left to right, numbered from $1$ to $n$.
Xiao Bao is Little Y’s good friend. Every day, she takes away some apples.
Each day, when taking apples, Xiao Bao always starts from the leftmost (the $1$st) apple, and then takes $1$ apple for every $2$ apples (i.e., she takes the $1$st, $4$th, $7$th, ... in the current row). After that, Xiao Bao rearranges the remaining apples into a row again in the original order.
Xiao Bao wants to know: how many days does it take to take away all the apples, and on which day is the apple numbered $n$ taken away?
Input Format
The first line contains a positive integer $n$, representing the total number of apples.
Output Format
Output one line containing two positive integers, separated by a space, representing the number of days needed for Xiao Bao to take away all the apples, and the day on which the apple numbered $n$ is taken away.
Explanation/Hint
**[Sample $1$ Explanation]**
There are $8$ apples on Xiao Bao’s desk in total.
On day $1$, Xiao Bao takes away apples numbered $1$, $4$, and $7$.
On day $2$, Xiao Bao takes away apples numbered $2$ and $6$.
On day $3$, Xiao Bao takes away the apple numbered $3$.
On day $4$, Xiao Bao takes away the apple numbered $5$.
On day $5$, Xiao Bao takes away the apple numbered $8$.
**[Sample $2$]**
See apple/apple2.in and apple/apple2.ans in the contestant directory.
**[Constraints]**
For all testdata: $1\leq n\leq 10^9$.
| Test Point | $n\leq$ | Special Property |
| :----------: | :----------: | :----------: |
| $1\sim 2$ | $10$ | None |
| $3\sim 5$ | $10^3$ | None |
| $6\sim 7$ | $10^6$ | Yes |
| $8\sim 9$ | $10^6$ | None |
| $10$ | $10^9$ | None |
Special property: Xiao Bao takes away the apple numbered $n$ on the first day.
Translated by ChatGPT 5