Canadian Computing Competition: 2023 Stage 1, Senior #5
Alice, the mathematician, likes to study real numbers that are between
A filter covers part of the number line. When a number reaches a filter, two events can happen. If a number is not covered by the filter, the number will pass through. If a number is covered, the number will be removed.
Alice has infinitely many filters. Her first
In general, the
- Consider the number line from
to . - Split this number line into
equal-sized pieces. There are points and intervals. - The
-th filter consists of the interval, interval, interval, and in general, the interval. The points are not part of the -th filter.
Alice has instructions for constructing the Cantor set. Start with the number line from
Alice wants to research the Cantor set, and she came to you for help. Given an integer
Input Specification
The first line contains the integer
The following table shows how the available 15 marks are distributed:
Marks Awarded | Bounds on |
Additional Constraints |
---|---|---|
3 marks | ||
4 marks | None | |
8 marks | None |
Output Specification
Output all integers
Output the answers in increasing order. The number of answers will not exceed
Sample Input
12
Output for Sample Input
0
1
3
4
8
9
11
12
Explanation of Sample Output
Here is a diagram of the fractions and the first
Furthermore,
It can be shown that the remaining fractions will pass through all filters.
Comments
The problem should have a time limit of 3 seconds?