Gahui and Sousenkyo 4
Time limit1sMemory limit512 MB
Given the top vote count v and a gap k, pick the most distinct vote counts from 1 to v so that no two differ by exactly k.
- Level
Medium5 of 10
- Topics
- Math, Greedy, Implementation
- Solved
- No attempts yet
Problem
Gahui is watching the annual character election. After the election, the top 16 characters receive large benefits for one year. For that reason, fans vote hard to get their favorite characters into the top 16. Remarkably, at least one Cinderella appears in every election and achieves an outstanding result.
While watching the election, Gahui starts thinking about the following problem. The election has these four facts:
- No two characters have vote counts that differ by exactly .
- Every character has a different vote count.
- Every character has at least one vote.
- The character ranked 1st has votes.
Gahui wants to know the maximum number of characters that can take part in the election. Help Gahui find it.
Input
The input is one line with and separated by a space.
Output
Print on the first line, where is the number of characters taking part in the election.
On each of the following lines, print the number of votes of one character, in rank order. If there are multiple solutions, you may print any of them.
Constraints