A friend of Alex has gifted a movie collection, and Alex is excited to watch them all as quickly as possible. The duration of the movies is given in array durations[n], where n is the number of movies, and each movie duration lies between 1.01 and 3.00 units of time (up to two decimal places). Every day, Alex wants to spend no more than 3.00 units of time watching the movies but also wants to complete the movies in the least number of days possible. Alex does not leave a movie in between. That is, if Alex has picked up a movie, Alex watches the complete movie on the same day. Find the minimum number of days needed to watch all the movies.

Answers

Answer 1

To find out the duration of alex's movies, you can use the code in C++ to make this calculation, where you will only need the number of movies and their duration, as well:

Writing code in C++:

#include<bits/stdc++.h>

using namespace std;

struct Movie {

  int timeBegin, duration, timeEnd;

  bool operator<(const Movie& another) const {

     return timeEnd < another.timeEnd;

  }

};

struct Festival {

  int count;

  vector<Movie> movies;

};

Festival* initialize(int timeBegin[], int duration[], int count) {

  Festival* filmFestival = new Festival;

  filmFestival->count = count;

  for (int i = 0; i < count; i++) {

     Movie temp;

     temp.timeBegin = timeBegin[i];

     temp.duration = duration[i];

     temp.timeEnd = timeBegin[i] + duration[i];

     filmFestival->movies.push_back(temp);

  }

  return filmFestival;

}

int solve(Festival* fest) {

  int res = 0;

  sort(fest->movies.begin(), fest->movies.end());

  int timeEnd = -1;

  for (int i = 0; i < fest->count; i++) {

     if (fest->movies[i].timeBegin >= timeEnd) {

        res++;

           timeEnd = fest->movies[i].timeEnd;

     }

  }

  return res;

}

int main(int argc, char *argv[]) {

int timeBegin[] = {1, 3, 0, 5, 5, 8, 8};

int duration[] = {3, 2, 2, 4, 3, 2, 3};

Festival * fest;

fest = initialize(timeBegin,duration, 7);

cout << solve(fest) << endl;

return 0;

}

See more about C Code at brainly.com/question/17544466

#SPJ1

A Friend Of Alex Has Gifted A Movie Collection, And Alex Is Excited To Watch Them All As Quickly As Possible.

Related Questions

Question 3 of 10
in which part of the Scratch interface does a programmer combine code
blocks to build the program?
OA. Block palette
OB. Stage
OC. Scripts area
O D. Sprite info pane

Answers

The part of the Scratch interface that a programmer combine code

blocks to build the program is the Block palette.

Which part of the sprite screen has programming blocks?

The block palette is known to be the part where all the code blocks can be found.

Note that all the Blocks are said to be color coded by category and as such, The part of the Scratch interface that a programmer combine code

blocks to build the program is the Block palette.

Learn more about Scratch interface from

https://brainly.com/question/27820529

#SPJ1

Which longstanding restaurant chain closed its last location in lake george, new york?.

Answers

It’s Howard Johnson

You are working in a medical practice that sends out billing electronically but the software does not include a claim scrubber program. what can you, as an administrative medical assistant do?

Answers

When working in a medical practice that does not include a claim scrubber program the result of now no longer having a declare scrubbed previous to submission is that the exercise has a tendency to lose sales.

What is a scrubber software?

A declare scrubber software is referred to as software that facilitates in reviewing claims for coding and billing accuracy of patients. This software is normally protected as a software program whilst billing electronically in hospitals or for coverage purposes.

The results or dangers of now no longer having a declare scrubbed previous to submission is that the exercise has a tendency to lose sales.

Read more about the software:

https://brainly.com/question/1538272

#SPJ1

Consider the following code using the posix pthreads api:
thread2.c
#include
#include
#include
#include
int myglobal;
void *thread_function(void *arg) {
int i,j;
for ( i=0; i<20; i++ ) {
j=myglobal;
j=j+1;
printf(".");
fflush(stdout);
sleep(1);
myglobal=j;
}
return null;
}
int main(void) {
pthread_t mythread;
int i;
if ( pthread_create( &mythread, null, thread_function,
null) ) {
printf(ldquo;error creating thread.");
abort();
}
for ( i=0; i<20; i++) {
myglobal=myglobal+1;
printf("o");
fflush(stdout);
sleep(1);
}
if ( pthread_join ( mythread, null ) ) {
printf("error joining thread.");
abort();
}
printf("\nmyglobal equals %d\n",myglobal);
exit(0);
}
in main() we first declare a variable called mythread, which has a type of pthread_t. this is essentially an id for a thread. next, the if statement creates a thread associated with mythread. the call pthread_create() returns zero on success and a nonzero value on failure. the third argument of pthread_create() is the name of a function that the new thread will execute when it starts. when this thread_function() returns, the thread terminates. meanwhile, the main program itself defines a thread, so that there are two threads executing. the pthread_join function enables the main thread to wait until the new thread completes.
a. what does this program accomplish?
b. here is the output from the executed program:
$ ./thread2
..o.o.o.o.oo.o.o.o.o.o.o.o.o.o..o.o.o.o.o
myglobal equals 21
is this the output you would expect? if not, what has gone wrong?

Answers

The thing which the given program accomplishes is that it creates a method, declares variables, and executes commands if they meet the conditions in the code.

What is a Conditional Statement?

This is a type of statement that executes a line of code if a condition is not met.

Some types of conditional statements are:

IF statementIF-ELSE statementNested If-else statement.If-Else If ladder.Switch statement.

No, that is not the desired output because the integer should be less than 20.

Read more about conditional statements here:

https://brainly.com/question/11073037

#SPJ1

What will be the output, if any, when the user clicks the right mouse button?

from tkinter import
def clicked(event):
print("That hurt.")
widget = Button(None, text='Button')
widget.pack()
widget.bind('', clicked)
widget.mainloop()

O an error statement
O That hurt.
O no output
O Button

Answers

The output, if any, when the user clicks the right mouse button is (b) That hurt

How to determine the output?

The flow of the program implies that:

When the user clicks the button, the program prints "That hurt" without the quotes.

This action is on the third line of the program

Hence, the output, if any, when the user clicks the right mouse button is (b) That hurt

Read more about programs at:

https://brainly.com/question/16397886

#SPJ1

Desktop computers have a(n) ________ unit, located within the system unit, that plugs into a standard wall outlet, converts AC to DC, and provides the power to drive all the system unit components. Group of answer choices battery bus miniDC power supply

Answers

Answer:

The answer is power supply

Explanation:

i build pcs

what is a computer?write any four features of computer​

Answers

Answer:

A computer is defined as an electronic device for storing and processing data, typically in binary form, according to instructions given to it in a variable program.

Four features of a computer would be CPU, GPU, Memory, and Motherboard.

Explanation:

Computer is an electronic machine which accepts raw data from the user , process the data according to the predefined set of instructions, gives and stores the result or instructions....

Or

A computer is an electronic device that can perform several task according to the given instructions...

The four features of computer are :

Speed

Accuracy

Versatility

Diligence

Storage etc....

[tex]...[/tex]

When a motherboard fails, you can select and buy a new board to replace it. Suppose the motherboard in your computer has failed and you want to buy a replacement and keep your repair costs to a minimum. Try to find a replacement motherboard on the web that can use the same case, power supply, processor, memory, and expansion cards as your current system. If you cannot find a good match, what other components might have to be replaced (for example, the processor or memory)

Answers

When a motherboard fails, you can select and buy a new board to replace it then Replacing the motherboard in a pc is the maximum tough process.

What are a few pointers while deciding on a motherboard?

First Choose an appropriate chipset for a device.Check whether or not the motherboard maintenances the same processor Select board for the device with bendy speeds.Ensure that motherboard maintenance right reminiscence.Check the board that helps the sort of video you need.Check records, maintenance, and updates for the board.

Choosing the proper motherboard is first essential step wherein the processor that helps nicely are determined, reminiscence in what kind and what kind of reminiscence may be used also are determined, what sort of films may be supported and installed. In depending to this verbal exchange velocity and the device element are all have to be checked in a clean understanding earlier than deciding on motherboard.

Read more about the processor :

https://brainly.com/question/1538272

#SPJ1

What does Fees, Risk Assessment and Returns mean?

Answers

Answer:

The term return refers to income from a security after a defined period either in the form of interest, dividend, or market appreciation in security value. On the other hand, risk refers to uncertainty over the future to get this return. In simple words, it is a probability of getting return on security.

Explanation:

You saved your style options as "webstyle.css" in a subfolder called "styles."

what line do you include in the head section of your html file to use your styles?







Answers

A line which should be included in the head section of a html file to use these styles is link rel="stylesheet" type="text/css" href="styles/webstyle.css"

What is HTML?

HTML is an abbreviation for hypertext markup language and it can be defined as a standard programming language that is used for designing, developing and creating websites or webpages.

In Cascaded style sheet (CSS), a line which should be included in the head section of a html file to use these styles is given by:

link rel="stylesheet" type="text/css" href="styles/webstyle.css"

Read more on HTML here: https://brainly.com/question/4056554

#SPJ1

When you start an online course, what should you do to make sure you have access to college resources

Answers

As a student starting an online course, you should explore the college website to make sure you have access to college resources.

What is an online course?

An online course can be defined as an education programme that typically involves the process of providing and sharing learning resources (contents) in an organized way over the Internet, so as to allow the students (users) progress in their understanding of a course or topic.

As a student starting an online course, you should do the following to make sure you have access to college resources:

Explore the college website.Bookmark links to your course.Search for information with regards to advising, degree requirements, and financial aid.

Read more on online course here: https://brainly.com/question/14591988

#SPJ1

He was called "The father of computing c_______ B_______​

Answers

Answer:

computer basics.

Explanation:

because just it is father of computer basics

Answer:

charles babbage

Explanation:

Which Internet protocol (IP) packet fragmentation header field specifies where the fragment belongs in the original datagram

Answers

An Internet protocol (IP) packet fragmentation header field which specifies where the fragment belongs in the original datagram is the fragment offset.

What is the TCP/IP model?

The TCP/IP model is known as the Internet protocol suite or Transmission Control Protocol and Internet Protocol (TCP/IP) model and it can be defined as a standard framework that is designed and developed for the transmission (prepare and forward) of information on the Internet.

In the TCP/IP model, a fragment offset simply refers to an Internet protocol (IP) packet fragmentation header field which is used to specify where the fragment belongs in the original datagram.

Read more on Internet protocol here: https://brainly.com/question/17387945

#SPJ1

A program that performs handy tasks, such as computer management functions or diagnostics is often called a/an ____________.

Answers

Answer:

DOS

Explanation:

Disk operating

a customer is traveling to a branch office, and the network administrator provides her with a static ip address for her laptop. which should the customer do to use the static ip address

Answers

The customer traveling with a provided static IP address should assign the IP in the network adapter settings. Thus, option B is correct.

What is static IP?

The complete question is: A customer is traveling to a branch office, and the network administrator provides her with a static IP address for her laptop Which should the customer do to use the static IP address?

A) Run the command "ipconfig configure static"

B) Assign the static IP in network adapter settings

C) Switch the button from dynamic to static on her laptop

D) Disconnect from WiFi and use an Ethernet cable

E) Type the IP address into the browser

A static IP is a setup that is configured manually instead of the DHCP assigned setup. It is a constant and nonchanging IP setup that is used when working remotely.

In the network and sharing system, open the adapter setting and choose the appropriate adapter. Then choose the IPV 4 and check the current internet settings. Choose the desired IP address and then click the OK and save button.

Therefore, option B. static IP is assigned in the network setting option.

Learn more about static IP here:

https://brainly.com/question/18849429

#SPJ1

Select the correct answer. Nina is a lecturer at a university. She teaches physics to students, and in her classes she takes them through various laws of motion. What knowledge is Nina sharing with the students? A. procedural B. declarative C. heuristic D. meta

Answers

Based on the above, the kind of knowledge is Nina sharing with the students is Procedural Knowledge.

What is procedural knowledge in the classroom?

Procedural Knowledge is known to be the knowledge shared on how to perform a given skill or task, and it is seen as a knowledge linked to methods, procedures, or operations.

Note that based on the above, the kind of knowledge is Nina sharing with the students is Procedural Knowledge as she is teaching them the steps.

Learn more about knowledge from

https://brainly.com/question/9290109

#SPJ1

What physical disk oriented performance counter should be used to determine the number of requests waiting to be processed by a disk

Answers

Answer:

current disk queue length

Explanation:

When an interviewer asks "tell me about yourself", you should tell them about your childhood past. please select the best answer from the choices provided t f

Answers

In the interview when the candidate is asked about yourself then telling about childhood past is not correct. Therefore the given statement is false.

What is an interview?

An interview is an interaction or a conversation between an employer and the interested candidate. In the conversation the interviewee is asked about their education, family background, and work experiences.

When an interviewer ask about tell me about yourself, then the interviewee should not tell about their childhood past, rather the interviewee should give few information about their family, education, and working.

Therefore, the given statement is false.

Learn more about interview, here:

https://brainly.com/question/13073622

#SPJ1

Mediacom Communications has requested you to manage the access to its 802.11 standard wireless networks. A recent instance of errors in transmission has been recorded, and in order to fix this problem, you want to run a cyclical code to check for errors in transmission. In which field of the 802.11 data frame will you run this check

Answers

Based on the above scenario, in frame control field of the 802.11, the data frame will you run this check.

What are the three key 802.11 frame types?

There are 3 types of 802.11 frames which are:

ManagementcontrolData

Therefore, Based on the above scenario, in frame control field of the 802.11, the data frame will you run this check.

See full question below

Mediacom Communications has requested you to manage the access to its 802.11 standard wireless networks. A recent instance of errors in transmission has been recorded, and in order to fix this problem, you want to run a cyclical code to check for errors in transmission. In which field of the 802.11 data frame will you run this check?

a.

Sequence Control

b.

Trailer

c.

Data

d.

Frame Control

Learn more about Communications from

https://brainly.com/question/26152499

#SPJ1

Pedro has written a program in a high-level language to do some calculations for a friend. His friend needs to use the program immediately on his laptop. Pedro does not know what software is available on the laptop. Also, his friend's internet connection is very slow. Explain which type of translator Pedro should use for his program. Give reasons why this is the best choice in this case.​

Answers

In the case above, a Compilers is the best translator for a program that is said to be changed or written in a high-level language into machine code.

Why do you need to translate a program written in a high-level language into machine language?

Programming languages are known to be easy for humans to read and understand.

Note that The program (source code) need to be translated into machine language so that the computer can be able to carryout the program.

Therefore, In the case above, a Compilers is the best translator for a program that is said to be changed or written in a high-level language into machine code.

Learn more about machine language from

https://brainly.com/question/23275071

#SPJ1

What does business informWhat does business information management do?
A.
identify information requirements for coworkers
B.
identify information requirements for different management levels
C.
create project plans for the project management team
D.
produce sales turnover summary for the sales professionals
E.
create financial documents for the finance departmentation management do?

Answers

Answer:

B) identify information requirements for different management levels

Explanation:

Business information management is based off of identifying the needs of a company. (This is also a plato answer)

what are the methods of gilding

nonsense will be immediately reported. ​

Answers

Methods of gilding include hand application and gluing, typically of gold leaf, chemical gilding, and electroplating, the last also called gold plating. Parcel-gilt (partial gil) objects are only gilded over part of their surfaces.

Write an algorithim and flowchart to check it the temperature is more than 25°. If it more than 25°C switch fan on else off.​

Answers

Answer:

write the sly flowchart

Explanation:

#stdlib.etc

main()
{

    int temp;
    bool fan = false;

    print("enter the frigin temperature: ");

    read(temp);

    if (temp > 25)

     {
         fan = true;
         print("the fan is on");
     }
     else
      {

           print("the fan is off");

      }

      return 0;

}

A class that implements an interface must provide an implementation for all ____ methods. Group of answer choices private final static abstract

Answers

Answer:

Abstract

Explanation:

I think it’s abstract because, in the question it says that it implements an interface and must provide an implementation for

And my answer was abstract methods.

Other Questions
Given the right triangle, evaluate: sin 0. please help me with this if you can? thanks alot :))) The building of a railroad network led to industrial growth becauseA. raw materials and finished products were shipped quickly and cheaply.B. finished products were shipped quickly to rural Canada.c. finished products were shipped quickly and cheaply to factories.d. raw materials were shipped quickly and cheaply to consumers. PLEASE HELP THIS IS DUE BY MIDNIGHT TONIGHT!!!!Calculate the average daily temperature for each thermometer. What is the difference between the two? What letter does not have a sound in Spanish? 1. H 2. Ch 3. S 4. V The graph of y=cosx is translated by (30,-1). What is the equation of the translated graph? A box shaped like a rectangular prism has a length of 8 inches and width of 8 inches. Its volume is 512 cubic inches. What is the height of the box? URGENT!!! Based on the following reaction, how much water is produced when oxygen react with 1 mole of CH8? CH8 (g) + 40 (g) 2CO2 (g) + 4HO(g) please help with geometry!!!! i will mark brainliest How did both Gandhis nationalist movement in India and Kemals in Turkey differ in terms of their methods of protest and their attitudes toward the West? What actions did each call for the people to take? Which two companies are among the "big six" enterprise platform partners used by accenture's intelligent platform services (ips) business? A bacteria population has been doubling each day for the past 5 days. It is currently100000. What was the population 5 days ago? AlbeRead the passage.The age requirement for voting was enacted after theCivil War by the Fourteenth Amendment, setting thevoting age at 21. The Twenty-Sixth Amendment,ratified in 1971, decreased the age from 21 to 18. Thisamendment was proposed in response to the VietnamWar. Since many of those drafted to fight werebetween 18 and 20, Congress did the right thing bylowering the voting age.Which sentence from the passage indicates that thesource is not entirely credible?"The age requirement for voting was enacted afterthe Civil War by the Fourteenth Amendment, settingthe voting age at 21."O "The Twenty-Sixth Amendment, ratified in 1971,decreased the voting age from 21 to 18.""This amendment was proposed in response to theVietnam War.""Since many of those drafted to fight were between18 and 20, Congress did the right thing by loweringthe voting age. which of these describes the gulf stream How many units is -14 away from 0 Which characteristic of a legend is detailed in this excerpt?spiritual beliefs of a cultureearly period settingstrength of a hero figureexplanation of natural events which graph below shows the solutions for the linear inequality y help i have to study for 3 exams and i have to do this homework Como localizar a una persona por su numero de telefono. Explain how slavery further divided the nation.