Submit | All submissions | Best solutions | Back to list |
EIUCOL20Q3H - Living Cost (H) |
Beo go to market every sunday to buy 3 kinds of food which he need for the next week. The kinds of food have price p1, p2, and p3 for each piece respectively. Among of them he like the first one more than the second one, and like the second one more than the last one. He try to buy as much as possible the first kind of food, then as much as possible the second kind of food. With the exactly X vnd, how many each kind of food will he buy?
Input
- The first line has an integer X (0 ≤ X ≤ 107).
- The second line has 3 integers p1, p2, p3 respectively (0 ≤ pi ≤ 107).
Output
Three integers which are the number of pieces of each kind of food (food 1, food 2, food 3) that Beo will buy. Print an emply line if there is not any solution.
Sample
Input |
Output |
28 3 5 7 |
7 0 1 |
Added by: | Ha Minh Ngoc |
Date: | 2020-09-04 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | CSHARP C++ 4.3.2 CPP CPP14 CPP14-CLANG FSHARP GO JAVA JS-MONKEY NODEJS PHP PYTHON PYPY PYPY3 PYTHON3 RUBY SQLITE SWIFT VB.NET |