Marks :50
: 3 | : 2
A cloud service provider offers quantity discounts based on the number of virtual machines a customer needs. Their offerings vary from 2 to 2000 instances. When pricing is requested, the customer's representative refers to a list of past pricing. Given a list of past price quotes and the number of instances a customer needs, determine the per-instance price for the customer.
The method for determining price is as follows:
The first line of input consists of a single integer $$$n$$$ $$$(1 \leq n \leq 2000)$$$ $$$-$$$ the number of instances the customer needs. The second line of input consists of a single integer $$$m$$$ $$$(1 \leq m \leq 10^5)$$$ $$$-$$$ the total number of past prices. The third line consists of $$$m$$$ space separated integers $$$-$$$ where the $$$i_{th}$$$ integer represents $$$instances[i]$$$. The fourth line consists of $$$m$$$ space separated floating point numbers $$$-$$$ where the $$$i_{th}$$$ number represents $$$price[i]$$$.
Output a single floating point number $$$-$$$ the per instance price, which should be precise upto 6 decimal places.
75 3 25 50 100 5.0 4.0 3.0
3.500000
25 5 10 25 50 100 500 2.46 2.58 2.0 2.25 3.0
2.58
You need to login to view your submissions.
You need to login to view all submissions.
Result : Executed
Feel something is wrong with the test cases?
Result : Accepted
Test Cases :
But to Run or Submit the Problem, you need to Log In.
Continue to Log InYour challenge has been submitted successfully.
You will get a response soon via WhatsApp or Email.
Do let us know your issue.