Skip to content

Create Pizza #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions Pizza
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
Pizza Is a dish of Italian origin, consisting of a flat round base of dough baked with some toppings.
It is basically Circular in shape. It comes in 3 sizes-
Small, Medium, and Large Pizza.

Abhinav is crazy for Pizzas.
Small Pizza has an area of 'S' units^2
Medium Pizza has an area of 'M' units^2
Large Pizza has an area of 'L' units^2

Cost of Small, medium and Large Pizza is 'CS' , 'CM', and 'CL' respectively.
Abhinav wants atleast 'X' units^2 of pizza .
What is the minimum amount of Rs. needed so that Abhinav can buy atleast X units square of Pizza?
If more than 1 arrangement is possibleChoose that one which requires Least Money.

Two arrangements are said to be different if They have different quantities of Small , medium , or large pizzas!

Input:
First line contains the number of test cases-T
The next line contains 6 integers- X, S,M , L , CS, CM, CL

Output:
Output one integer the minimum amount of Rs. needed.

Constraints:
1<=T<=100
1<=X<=500
1<=S< M< L<=100
1<=CS< CM<=1000

Example:
Input:
1
16 3 6 9 50 150 300
Output:
300


Explanation:

We want atleast 16 units^2 of Pizza

1S 1M 1L area= 3+6+9=18sq units , Cost=500

6S area=18 sq units, Cost=300

2L area=18 sq units, Cost=600

etc.

of all the Arrangements, Minimum Cost is Rs. 300.