Sunny and Johnny like to pool their money and go to the ice cream parlor. Johnny never buys the same flavor that Sunny does,
The only other rule they have is that they spend all of their money.
Given a list of prices for the flavors of ice cream, select the two that will cost all of the money they have.
(1,3,4,5,6). The two flavors costing 1 and 5
For example, they have m = 6 to spend and there are flavors costing cost
meet the criteria. Using 1-based indexing, they are at indices 1 and 4.
Function Description
Complete the icecreamParlor function in the editor below. It should return an array containing the indices of the prices of the
two flavors they buy, sorted ascending.
icecream Parlor has the following parameter(s):
. m: an integer denoting the amount of money they have to spend
• cost: an integer array denoting the cost of each flavor of ice cream
Input Format
The first line contains an integer, t, denoting the number of trips to the ice cream parlor. The next t sets of lines each describe a
visit. Each trip is described as follows:
1. The integer m, the amount of money they have pooled.
2. The integer n, the number of flavors offered at the time.
3. n space-separated integers denoting the cost of each flavor: cost[cost[1], cost(2), ., cost[n]]
Note: The index within the cost array represents the flavor of the ice cream purchased.
...
Answers
Answered by
0
Answer:
Vaccines are made from microbes that are dead or inactive so that they are unable to cause disease. The antigen in the vaccine is the same as the antigen on the surface of the disease-causing microbe. The vaccine stimulates the body to produce antibodies against the antigen in the vaccine. The antibodies created will be the same as those produced if the person was exposed to the pathogen. If the vaccinated person then comes into contact with the disease-causing microbe, the immune system remembers the antibodies it made to the vaccine and can make them faster. The person is said to be immune to the pathogen.
Similar questions