Submit | All submissions | Best solutions | Back to list |
EIUCOL20Q3 - Living Cost |
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. With the exactly X vnd, how many ways he can buy?
Input
- The first line has an integer X (1 ≤ X ≤ 107).
- The second line has 3 integers p1, p2, p3 respectively (1 ≤ pi ≤ 107).
Output
Print the number of way he can buy.
Sample
Input |
Output |
28 3 5 7 |
6 |
* Beo can buy any of these set (0*3+0*5+4*7), (1*3+5*5+0*7), (2*3+3*5+1*7), (3*3+1*5+2*7), (6*3+2*5+0*7), (7*3+0*5+1*7)
Added by: | Ha Minh Ngoc |
Date: | 2020-09-03 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: GOSU |