Question: in C++ please Example 1: prices = [4, 10, 25] Experimentation Days = [1, 3, 8, 9, 22, 23, 28, 31] output: 28 Explanation: 30-day

 in C++ please Example 1: prices = [4, 10, 25] Experimentation

in C++ please

Example 1:

prices = [4, 10, 25]

Experimentation Days = [1, 3, 8, 9, 22, 23, 28, 31]

output: 28

Explanation: 30-day subscription is not enough to cover 31 days.

28 = 10 + 10 + 4 + 4

10 = 1-week subscription to cover days 3 to 9

10 = 1-week subscription to cover days 22 to 28

4 = 1-day subscription to cover day 1

4 = 1-day subscription to cover day 31

code structure :

#include

#include

int MinSubscription(int D, int * Days, int * Prices){

RETURN 0; }

A company ABC requires to use an online server for research experimentation for a certain number of days. The server will be used on certain days but not every day. To use an online server, the company is required to subscribe to a cloud provider. A cloud provider offers 3 subscriptions options: 1-day subscription, a 1-week subscription, or a 30-day subscription, each one of them has a price that can be found in a given array of prices, where prices [0] represents the price of a 1-day subscription, prices [1] represents the price of a 1-week subscription, and prices [2] represents the price of a 30-days subscription. Write a function Minsubscription to find the minimum amount of money that company ABC needs to have in order to use a server during all the experimentation days. Your function MinSubscription takes as parameters 3 values: E which represents the number of experimentation days. Days which has E integer values that represent the experimentation days Di where 1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!