1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
zhenek [66]
2 years ago
14

/* Function findBestVacation * duration: number of vacation days * prefs: prefs[k] indicates the rate specified for game k * pla

n: array with 366 positions with the sequence of games * to be played over the year. In other words, * plan[k] indicates the game planned for day k (1

Engineering
1 answer:
alexira [117]2 years ago
3 0

Answer:

This is the C++ code for the above problem:

#include<bits/stdc++.h>

using namespace std;

int computeFunLevel(int start, int duration, int prefs[], int ngames, int plan[]) {

if(start + duration > 365) { //this is to check wether duration is more than total no. of vaccation days

return -1;

}

int funLevel = 0;

for(int i=start; i<start+duration; i++) { //this loop runs from starting point till

//start + duration to sum all the funlevel in plan.

funLevel = funLevel + prefs[plan[i]];

}

return funLevel;

}

int findBestVacation(int duration, int prefs[], int ngames, int plan[]) {

int max = 0, index = 0, sum = 0 ;

for(int i=1; i<11; i++){ //this loop is to run through whole plan arry

sum = 0; //sum is initialized with zero for every call in plan ,

//in this case loop should run to 366,but for example it is 11

//as my size of plan array is 11

for(int j=0; j<duration; j++) { // this loop is for that index to index+duration to calc

//fun from that index

sum = sum + prefs[plan[i]];

}

if(sum>max) { //this is to check max funlevel and update the index from which max fun can be achieved

max = sum;

index = i;

}

}

return index;

}

int main() {

int ngames = 5;

int prefs[] = { 1,2,0,5,2 };

int plan[] = { 0,2,0,3,3,4,0,1,2,3,3 };

int start = 1;

int duration = 4;

cout << computeFunLevel(start, duration, prefs, ngames, plan) << endl;

cout << computeFunLevel(start, 555, prefs, ngames, plan) << endl;

cout << findBestVacation(4, prefs, ngames, plan) << endl;

}

The screen of the program is given below.

You might be interested in
A circular hoop sits in a stream of water, oriented perpendicular to the current. If the area of the hoop is doubled, the flux (
natka813 [3]

Answer:

The flux (volume of water per unit time) through the hoop will also double.

Explanation:

The flux = volume of water per unit time = flow rate of water through the hoop.

The Flow rate of water through the hoop is proportional to the area of the hoop, and the velocity of the water through the hoop.

This means that

Flow rate = AV

where A is the area of the hoop

V is the velocity of the water through the hoop

This flow rate = volume of water per unit time = Δv/Δt =Q

From all the above statements, we can say

Q = AV

From the equation, if we double the area, and the velocity of the stream of water through the hoop does not change, then, the volume of water per unit time will also double or we can say increases by a factor of 2

3 0
3 years ago
3. This material is considered flammable.
almond37 [142]

Answer:

All of the above

Explanation:

Most of materials are flammable because of the chemicals theyre made up of.  Most materials that are bought say to keep them at room temature for a reason.

4 0
2 years ago
Read 2 more answers
How does a 2.5 MW wind turbine costing $ 4 million compare to a 5-kw wind turbine $3 /W? a) Same $/w b) Smaller $/w c) Larger $/
My name is Ann [436]
MW means megawatt, and one megawatt is a million Watts.
The 2.5 MW turbine is 4/2.5=1.6 $/w
Answer B
4 0
2 years ago
6. Find the heat flow in 24 hours through a refrigerator door 30.0" x 58.0" insulated with cellulose fiber 2.0" thick. The tempe
Ilia_Sergeevich [38]

Answer:

The heat flow in 24 hours through the refrigerator door is approximately 1,608.57 BTU

Explanation:

The given parameters are;

The duration of the heat transfer, t = 24 hours = 86,400 seconds

The area of the refrigerator door, A = 30.0" × 58.0" = 1,740 in.² = 1.122578 m²

The material of the insulator in the door = Cellulose fiber

The thickness of the insulator in the door, d = 2.0" = 0.0508 m

The temperature inside the fridge = 38° F = 276.4833 K

The temperature of the room = 78°F = 298.7056 K

The thermal conductivity of cellulose fiber = 0.040 W/(m·K)

By Fourier's law, the heat flow through a by conduction material is given by the following formula;

\dfrac{Q}{t} = \dfrac{k \cdot A \cdot (T_2 - T_1) }{d}

Q = \dfrac{k \cdot A \cdot (T_2 - T_1) }{d} \times t

Therefore, we have;

Q = \dfrac{0.04 \times 1.122578 \times (298.7056 - 276.4833 ) }{0.0508} \times 86,400 =1,697,131.73522

The heat flow in 24 hours through the refrigerator door, Q = 1,697,131.73522 J = 1,608.5705140685 BTU

7 0
2 years ago
A sample of cast iron with .35 wt%C is slow cooled from 1500C to room temperature. What is the fraction of proeutectoid Cementit
Marizza181 [45]

Answer:

So the fraction of proeutectoid cementite is 44.3%

Explanation:

Given that

cast iron with 0.35 % wtC and we have to find out fraction of proeutectoid cementite phase when cooled from 1500 C to room temperature.

We know that

Fraction of  proeutectoid cementite phase gievn as

{w_p}'=\dfrac{{C_o}'-0.022}{0.74}

Now by putting the values

{w_p}'=\dfrac{0.35-0.022}{0.74}

{w_p}'=0.443

So the fraction of proeutectoid cementite is 44.3%

6 0
2 years ago
Other questions:
  • The development team recently moved a new application into production for the accounting department. After this occurred, the Ch
    6·1 answer
  • . A roadway is being designed capable of allowing 70 mph vehicle speed. The superelevation around one curve is 0.05 inches per i
    15·1 answer
  • Using the results of the Arrhenius analysis (Ea=93.1kJ/molEa=93.1kJ/mol and A=4.36×1011M⋅s−1A=4.36×1011M⋅s−1), predict the rate
    10·1 answer
  • A tank with some water in it begins to drain. The function v ( t ) = 46 − 3.5 t determines the volume of the water in the tank (
    12·1 answer
  • According to the video, what are some of the effects of the increase in the use of automated tools for Loading Machine Operators
    10·2 answers
  • Technician A says that squeeze-type resistance spot welding (STRSW) may be used on open butt joints. Technician B says that repl
    14·1 answer
  • Sirens and flashing lights do NOT indicate that _____ may be nearby.
    7·2 answers
  • Which of the following was a sustainable power source used during the Middle Ages?
    9·2 answers
  • Yellow wood glue will typically also work with metal, glass, and adhesives
    13·1 answer
  • 9
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!