Click here to Skip to main content
15,906,329 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
A procurement of new clothing has arrived a store. The procurement contain 'm' Caps, 'n' Shirts, 'o' Pants and 'p' Shoes.

The store sells two types of clothing set:

First set consist of one cap and one shoes;
Second set consist of one shirt, one pants and one shoe. The First set costs 'a' coins and Second set costs 'b' coins
What could be the maximum possible cost of a set that can be assembled from the arrived clothings?

Note : One item cannot be used in more than one set however some items may be left unused.

Input Format

m(1≤m≤100000) — the number of caps.

n(1≤n≤100000) — the number of shirts.

o(1≤o≤100000) — the number of pants.

p(1≤p≤100000) — the number of shoes.

a(1≤a≤1000) — Cost of first set

b(1≤b≤1000) — Cost of second set


m(1≤m≤100000) n(1≤n≤100000) o(1≤o≤100000) p(1≤p≤100000) a(1≤a≤1000) b(1≤b≤1000)

Output Format

The maximum total cost of the set.

Sample Input 0

Sample Output 0

Explanation 0

Set of clothes
The optimal solution here is to compose three clothing set of the first type and four clothing set of the second type. The total cost is 3⋅2+4⋅0=6.

Sample Input 1

Sample Output 1


What I have tried:

I am not able to understand this qs
Updated 19-Jun-22 1:23am

I am not able to understand this qs
Then go back to your teacher and ask them to explain it to you. This forum is for answering technical questions not for trying to second guess what your homework is about.
Share this answer
While we are more than willing to help those that are stuck, that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you.

So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in!
Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did.

Read the assignment carefully - it's pretty specific and clear. Try working it out manually and see how far you can get before you start thinking about code!

If you are having problems getting started at all, then this may help: How to Write Code to Solve a Problem, A Beginner's Guide[^]
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900