-->
当前位置:首页 > 题库

PROGRAMMING:Business without fraud

Luz5年前 (2021-05-10)题库431
Today, a buyer came to the vegetable market to buy vegetables. He was willing to buy all kinds of vegetables, but * * he only bought vegetables with integer weight * *, because when you recommended vegetables, the introduction was very impressive, which made him very interested. However, his backpack has limited capacity and can only hold a certain weight. If it exceeds the limit, the backpack will easily burst, which will break the vegetables. He didn't want to take the risk. It is said that there is no adultery, no business. Of course, your vegetables are fresh, so you plan to earn the most profit within the allowable range of his backpack capacity (< = Backpack Capacity).
###Input format:
Note: in the process of transaction, all transactions are the purchase of integer weight kg, and there is no decimal situation similar to the purchase of 0.5kg, so the results of input and output are also integer;
The first line is an integer $$n (1 < = n < = 1E5) $, $$m (1 < = m < = 1E5) $. N is the weight of knapsack (kg), M is the type and quantity of vegetables.
Next, row m, three numbers in each row $$k, x, y $$are the current weight of vegetables on sale (kg), the purchase price of vegetables, and the current selling price of vegetables$$( 1 <= k , x , y <= 1e5)$$。
Pay attention to examine the topic, look at the data, except for the data agreement given by the topic, do not make any other special guarantee, please read carefully.
###Output format:
Output a line of an integer represents the maximum profit.
###Input sample 1:
```in
10 8
8 1 10
5 8 9
6 1 4
1 1 8
7 4 5
66 5 7
23 6 9
2 8 91
```
###Output sample 1:
```out
two hundred and thirty-eight
```
###Input sample 2:
```in
4 2
8 8 9
5 6 6
```
###Output sample 2:
```out
four
```







answer:If there is no answer, please comment