Huawei OD machine test - efficient freight transportation (Java & JS & Python & C)

Question description

Lao Li is a freight company carrier, and Lao Li's truck has a rated cargo weight of wt.

There are two types of goods:

  • The weight of a single piece of goods A is wa, and the freight profit of a single piece is pa.
  • The weight of a single piece of goods B is wb, and the freight profit of a single piece is pb.

The total weight of the cargo carried by Lao Li every time he departs is exactly the rated cargo weight wt of the truck. There must be both cargo A and cargo B on the truck. Cargo A and B cannot be cut.

What is the maximum profit that Lao Li can earn from a single full-load shipment?

Enter description

The first column input is the unit weight wa of goods A.

  • 0 < wa < 10000

The second column input is the unit weight wb of goods B.

  • 0 < wb < 10000

The third column input is the rated load wt of the truck.

  • 0 < wt < 100000

The fourth column input is the single-piece freight profit pa of goods A.

  • 0 < pa < 1000

The fifth column input is the single-piece freight profit pb of goods B.

  • 0 < pb < 1000

Output description

Maximum profit for a single full load shipment

Example

enter 10 8 36 15 7

Supongo que te gusta

Origin blog.csdn.net/qfc_128220/article/details/134725218
Recomendado
Clasificación