#P6188. [NOI Online #1 入门组] 文具订购
[NOI Online #1 入门组] 文具订购
Problem Description
Xiaoming’s class has a total class fund of yuan. The students plan to use the fund to collectively buy kinds of items:
- Compass, yuan each.
- Pen, yuan each.
- Notebook, yuan each.
Xiaoming is responsible for ordering the stationery. Let the ordered quantities of compasses, pens, and notebooks be respectively. His ordering rules, in order, are:
- The yuan must be spent exactly, i.e. .
- Subject to the above condition, the number of complete sets should be as large as possible, i.e. should be as large as possible.
- Subject to the above conditions, the total number of items should be as large as possible, i.e. should be as large as possible.
Please help Xiaoming find the optimal plan that satisfies the conditions. It can be proven that if a plan exists, then the optimal plan is unique.
Input Format
The input contains only one line with one integer, representing the class fund amount .
Output Format
If there is no solution, output .
Otherwise, output one line with three integers separated by spaces, representing the numbers of compasses, pens, and notebooks.
1
-1
14
1 1 1
33
1 2 6
Hint
Explanation of Sample Input/Output 3
is also a plan that satisfies conditions and , but for condition , this plan buys only items in total, which is worse than the plan .
Constraints
- For test points , is guaranteed.
- For test points , is guaranteed to be a multiple of .
- For test points , is guaranteed.
- For all test points, is guaranteed.
Translated by ChatGPT 5