#P9748. [CSP-J 2023] 小苹果

[CSP-J 2023] 小苹果

Problem Description

There are nn apples on Little Y’s desk, arranged in a row from left to right, numbered from 11 to nn.

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 11st) apple, and then takes 11 apple for every 22 apples (i.e., she takes the 11st, 44th, 77th, ... 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 nn taken away?

Input Format

The first line contains a positive integer nn, 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 nn is taken away.

8
5 5

Hint

[Sample 11 Explanation]

There are 88 apples on Xiao Bao’s desk in total.
On day 11, Xiao Bao takes away apples numbered 11, 44, and 77.
On day 22, Xiao Bao takes away apples numbered 22 and 66.
On day 33, Xiao Bao takes away the apple numbered 33.
On day 44, Xiao Bao takes away the apple numbered 55.
On day 55, Xiao Bao takes away the apple numbered 88.

[Sample 22]

See apple/apple2.in and apple/apple2.ans in the contestant directory.

[Constraints]

For all testdata: 1n1091\leq n\leq 10^9.

Test Point nn\leq Special Property
121\sim 2 1010 None
353\sim 5 10310^3
676\sim 7 10610^6 Yes
898\sim 9 None
1010 10910^9

Special property: Xiao Bao takes away the apple numbered nn on the first day.

Translated by ChatGPT 5