[Huawei OD machine test 2023 latest] Maximum profit (C language problem solution)

topic description

The businessman runs a store with number of commodities.
Due to the warehouse limit, the maximum holding quantity of each commodity is item[index] and
the price of each commodity is item-price[item_index][day]
through buying and selling of commodities Get profit
Please give the maximum profit that the merchant can get in days
Note: The same product can be bought and sold repeatedly

enter description

The first line enters the quantity of the product number, such as 3
The second line enters the number of days the product is sold, such as 3
The third line enters the warehouse limit The maximum holding quantity of each product is item[index], such as 4 5 6

Continue to enter the number row and the days column, the meaning is as follows: the
daily price of the first item, such as 1 2 3
the daily price of the second item, such as 4 3 2
the daily price of the third item, such as 1 5 3

output description

Output the merchant's maximum profit during this period.

Example

enter 3
3
4 5 6
1 2 3
4 3 2
1

Guess you like

Origin blog.csdn.net/shangyanaf/article/details/130233443