2023 HUAWEI OD machine test real questions C language realization [maximum profit]

topic

A businessman runs a store with number of products.
Due to warehouse restrictions, the maximum number of items held is item[index]

The price of each item is item-price[item_index][day]

Profit is obtained by buying and selling commodities
Please give the maximum profit that the merchant can obtain in days days

Note: The same product can be bought and sold repeatedly.
Input description
3 The first line enters the quantity of the product number

3 The second line enters the days of product sales days
4 5 6 The third line enters the warehouse limit The maximum holding quantity of each item is item[index]

1 2 3 The daily price of the first item

4 3 2 The price of the second item per day

1 5 3 The daily price of the third item

Output description:

The maximum profit a businessman can obtain in days days

Example 1:

enter:

3

3

4 5 6 

1 2 3

4 3 2 

1 5 3 

output:

32

Example 2 :

enter:

1

1

1

1

output:

0

train of thought

1: This description is a bit weird. The number of product types and the number of products are both fuzzy items. The real problem that needs to be solved is the two dimensions of a single product type and a single product quantity these days.

Guess you like

Origin blog.csdn.net/misayaaaaa/article/details/132458530