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

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

A(n) ______is like an intranet except it shares its resources with users from a distant location. Select your answer, then click Done.

Answers

An extranet is like an intranet except that, it shares its resources with users from a distant location.

What is an intranet?

An intranet simply refers to an internal organizational network which is exclusively designed and developed to be used privately. Also, it is used for providing the employees of an organization with easy access to data and information.

In Computer networking, the end users of an extranet have the ability to access a company's entire intranet from a distant location.

Read more on intranet here: https://brainly.com/question/2580626

#SPJ1

If you walked into a room containing three computers and were told one of them was infected with malware, how would you determine which one it is

Answers

To detect it one can only know if:

Your web browser freeze or is unresponsive?System is filled with a lot of pop-up messages?Your computer run slower than normal, etc.

How can you detect a malware in your computer?

To Know if You Have Malware in your system, one can dectect it if your system often or suddenly slows down, crashes, or others.

Note that To detect it one can only know if:

Your web browser freeze or is unresponsive?System is filled with a lot of pop-up messages?Your computer run slower than normal, etc.

Learn more about Malware from

https://brainly.com/question/399317

#SPJ1

Suppose you want to sell your product to of one of the school canteen of El Salvador city thus you conducted study to one of the schools in El Salvador city Misamis Oriental to determine the factors affecting consumer preferences of the students ages 16 to 19 years old. The following data were given. Table 1 of Respondents by Age Distribution Age Frequency Percent 16 yrs. old 370 45.12 17 yrs.old 200 24.39 18 yrs. old 150 18.29 19 yrs. old 100 12.20 Total 820 100 Kindly write your interpretation, based on the data given in table 1. Remember to write first the comparison and contrast of the data given, its implication to the study and connect it with your review of related literature.

Answers

The interpretation of the table is that it shows that 45.12 percent of the respondents are in 16 years of age when likened to 12.20 percent who are 19 years old and 18.29 percent that are in 18 years of age.

What is the table about?

The table is one that shows the age profile for Filipino children from 0 to 4 years and above to 19 years,

Note that it is also made up of the largest age group making up from 10.1 to 10.7 percent as seen on the Philippine Statistics Authority (PSA).

Therefore, students that are in 16 years of age will have the ability to take in or consume products more than the older students as seen in El Salvador City.

Learn more about product  from

https://brainly.com/question/10873737

#SPJ1

Nasim has a smart phone data plan that costs $25 per month that includes 9 GB of data, but will charge an extra $20 per GB over the included amount. How much would Nasim have to pay in a month where he used 5 GB over the limit

Answers

Answer:

$125

Explanation:

Charge for 9GB  + Charge for 5GB over limit

$25 + 5 x $20 = $125

write a program in Python and explain how we do the program

Answers

please send what program, I will help you.

Answer:

num1 = 1.5

num2 = 6.3

sum = num1 + num2

print('The sum of {0} and {1} is {2}'.format(num1, num2, sum))

Explanation:

This program adds up two numbers.

num1 = 1.5 means that a variable called num1 has been assigned to the number 1.5num2 = 6.3 means that a variable called num2 has been assigned to the value 6.3sum = num1 + num2 means that the variables num1 and num2 have been added together and their total has been assigned to the new variable sumprint('The sum of {0} and {1} is {2}'.format(num1, num2, sum)) means that the text that will be printed shall read out the sum of their answers formatted with brackets that are kept in place of their respective variables.

1. what is the purpose of giving an id to an html element when using javascript?

Answers

Answer:

It is also used by JavaScript to access and manipulate the element with the specific id.

How do you remove only the conditional formatting from a cell and leave all other formatting intact.

Answers

This is done by selecting the Conditional Formatting button via the HOME tab, take the arrow or point to Clear Rules, and select Clear Rules from full Sheet.

How do I remove conditional formatting and also keep formatting?

The step is to first enable the sheet you want to delete the conditional formatting rules and then keep format.

One can click on Alt + F11 keys to open Microsoft Visual Basic for Applications window then Click Insert > Module, and then Remove conditional formatting rules and also keep format.

Learn more about formatting from

https://brainly.com/question/766378

#SPJ1

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


Describe the different types of computers. What is the most common type? What are the types of personal computers?

Answers

Answer:

Supercomputers are the fastest computers,  but at the same time are the very expensive ones. This type of computer is usually used on scientific research centers.Mainframe Computers can cater numerous users and support programs happening at the same time. This type of computer is usually used by governments and large organizations.Minicomputers can cater to users ranging from 4 to 200 simultaneously. This type of computer is the mid-sized one.Microcomputers can cater to one user at a time. This type of computer is the most common type because they are not that costly.

Answer:

Explanation:

There are two basic flavors of chassis designs–desktop models and tower models–but there are many variations on these two basic types. Then come the portable computers that are computers small enough to carry. Portable computers include notebook and subnotebook computers, hand-held computers, palmtops, and PDA

A one page document that introduces you, your skills and background and asks for an interview is an example of what type of document? career portfolio resume cover letter job application

Answers

Answer:

That would be a cover letter.

Explanation:

Hope this helps!

Cover letter is the type of document, as A one-page document that introduces you, your skills and background and asks for an interview. Hence, option C is correct.

What is a Cover letter?

A cover letter for your job application is one page long and attached. Its purpose is to provide you with a brief overview of your professional background.

A CV gives detailed information about your professional past and educational credentials, whereas a cover letter is a brief document that summarizes your reasons for applying for the job.

Yes, a cover letter should go with your introduction. Give your name, the job you're applying for, and the source of your information. For instance, I'm Henry Candidate and I'm submitting my application for the open Account Manager position listed on LinkedIn.

Thus, option C is correct.

For more information about Cover letter, click here:

https://brainly.com/question/10626764

#SPJ5

Write a program that accepts the lengths of three sides of a triangle as inputs. the program output should indicate whether or not the triangle is a right triangle. recall from the pythagorean theorem that in a right triangle, the square of one side equals the sum of the squares of the other two sides. use the triangle is a right triangle. and the triangle is not a right triangle. as your final outputs.

Answers

The code will have to obey the Pythagorean theorem that says square of the hypotenuse side is equals to the sum of the squares of the other legs.

How to write a code that check if a triangle is a right angle by using Pythagoras theorem?

The code is written in python.

def right_triangle(x, y, z):

    if x**2 + y**2 == z**2 or y**2 + z**2 == x**2 or z**2 + x**2 == y**2:

         print("it is a right angle triangle")

    else:

         print("it is not a right angle triangle")

right_triangle(6, 10, 8)

Code explanationwe defined as function named "right_triangle". x, y and z are argument which are the length of the triangle.Then we check if the sides obeys Pythagoras theorem.If it does we print a positive statement else we print a negative statement.

Learn more about python at: https://brainly.com/question/21437082

#SPJ4

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

To conserve its public IP addresses, a company can instead use ____ addresses for devices within its own network boundaries.

Answers

Answer:

private ip addresses

Explanation:

A private ip address is assigned to each device on a network, allowing devices on the same network to communicate with each other without using any public ip addresses.

Taking control of admin functionality and misusing sensitive data that are unauthorized to access are due to.

Answers

Taking control of admin functionality and misusing sensitive data that are unauthorized to access are due to Broken Access Control.

What leads to broken access control?

The Common access control issues  are:

The Bypass of access control checks via the modification of the URL.Internal application state.The use of custom API attack tool.

Note that Taking control of admin functionality and misusing sensitive data that are unauthorized to access are due to Broken Access Control.

See options below

This is a List of Available Answers Options :

Xml Enternal Entities Injection

SQL Injection

Cross site scripting

Broken Access Control

Learn more about admin from

https://brainly.com/question/26096799

#SPJ1

What is an example of a way a farm could apply new technology to improve sustainability?

Answers

An example of a way a farm could apply new technology to improve sustainability is via the use artificial intelligence to predict and adjust the farm's water usage.

How is artificial intelligence used in farming?

The use of AI systems is one that can help to make better the total harvest quality and accuracy which is known to be precision agriculture.

Note that An example of a way a farm could apply new technology to improve sustainability is via the use artificial intelligence to predict and adjust the farm's water usage.

Learn more about sustainability from

https://brainly.com/question/26195041

#SPJ2

A hashing approach: group of answer choices will often support constant time storage and retrieval of keys. only works if the keys are integral. is guaranteed to provide o(1) storage and retrieval of keys. is typically very space efficient. none of these is correct.

Answers

In technology, the hashing approach transforms the character into the other values. It is guaranteed to provide O(1) storage and retrieval of keys. Thus, option C is correct.

What is a hashing approach?

A hashing approach is a programming technique that is used to convert the range of the key values into the indexes and is majorly used in the hash tables.

The hash functions take the O(1) and retrieve making them fast to work with. It always does not necessarily work if the keys are integrated and are also is not much space sufficient.

Therefore, the option C. hashing approach is a guaranteed technique.

Learn more about hashing approach here:

https://brainly.com/question/14397218

#SPJ1

Physical and data link layer standards govern transmission in ________. LANs WANs Both LANs and WANs Neither LANs nor WANs

Answers

Answer:

Both LANs and WANs

Explanation:

Physical layer standards govern physical links between devices which includes connectors, plugs, transmission media, and signaling.

the force of impact is

Answers

Answer:

the force of impact is the force generated when objects meet

If an algorithm produces an unexpected outcome, what is the most likely
reason?
A. It is sequenced incorrectly.
B. It is too long and time-consuming.
C. Its purpose is too specific.
D. It is too short and fast.

Answers

Option d is the best answer

What is the next step an organization should take after capturing and collecting data?

Answers

Answer: I think this is right Step 1: Identify issues and/or opportunities for collecting data. Step 2: Select issue(s) and/or opportunity(ies) and set goals. Step 3: Plan an approach and methods. Step 4: Collect data.

Computer are most wonderful creation of 21st century how ?​

Answers

Answer:

It can do all the functions at a speedy rate and also helps us to search and progress in our homes and businesses. A computer can therefore be called a calculator with a twist for not only does it perform fast calculations, but it also has other special characteristics.

Explanation:

hope it helps you

True or false: if you are adding your own css sheet, make sure your css file comes before the bootstrap css file.

Answers

If you are adding your own CSS sheet, make sure your css file comes before the bootstrap CSS file this is false.

How do I combine Bootstrap with CSS?  

How to use Bootstrap CSS. To use Bootstrap CSS, you need to integrate it into your development environment. All you have to do is create a folder on your computer. Save the compiled CSS and JS files, as well as the new HTML file that loads Bootstrap, in this folder.

Especially, jQuery and Popper are required. js and its own JavaScript plugin. Place the following Deleted at the bottom of the page, just before close & lt; / body & gt ;. -Tag and activate.

Read more about the bootstrap :

https://brainly.com/question/14959829

#SPJ1

Which technology, when combined with agile and devops, will help the team receive real-time feedback?

Answers

A technology which when combined with Agile and Devops that'll help the Accenture Technology team receive real-time feedback is a cloud.

What is a cloud?

In Computer technology, a cloud simply refers to the elastic leasing of pooled computer resources such as physical hardware through virtualization and over the Internet, so as to enable the storage and sharing of files and documents virtually and in  real-time.

In this context, a cloud is a technology which when combined with Agile and Devops that'll help the Accenture Technology team receive real-time feedback.

Read more on cloud here: https://brainly.com/question/19057393

#SPJ1

Keyboards, mice, speakers, microphones, and printers are collectively referred as

Answers

Answer:

I'm not sure. Maybe HID (Human Interface Devices)?

If a while loop iterates forever,what is the most likely cause?

Answers

Answer:

Runtime error probably. The program won't make it past the while loop in the code.

Answer: The loop has a condition that cannot possibly be false.

Explanation:

The ports ranging from 49,152 to 65,533 can be used as temporary or private port numbers. They are called

Answers

The ports ranging from 49,152 to 65,533 can be used as temporary or private port numbers. They are called as Dynamic ports.

What are the Ports ?

Ports with numbers 0–1023 are known as device or famous ports; ports with numbers 1024-49151 are known as consumer or registered ports, and ports with numbers 49152-65535 are known as dynamic, non-public or ephemeral ports.

Dynamic ports—Ports withinside the variety 49152 to 65535 aren't assigned, controlled, or registered. They are used for transient or non-public ports. They also are referred to as non-public or non-reserved ports.

Read more about the Dynamic ports:

https://brainly.com/question/4287621

#SPJ4

Cybersecurity breaches in the workplace generally happen because _____. Select 3 options. people deliberately try to hack into the network people deliberately try to hack into the network people do not know about cybersecurity protocols people do not know about cybersecurity protocols people make unintentional mistakes people make unintentional mistakes workplaces tend to have too strict cybersecurity protocols workplaces tend to have too strict cybersecurity protocols cybersecurity specialists do not really help

Answers

Cybersecurity breaches in the workplace generally happen because:

People deliberately try to hack into the network people.People make unintentional mistakes.People do not know about cybersecurity protocols

What are the three main causes of security breaches?

The major reasons for data breaches are:

Old, Unpatched Security Vulnerabilities. Human ErrorMalware, etc.

Therefore, Cybersecurity breaches in the workplace generally happen because:

People deliberately try to hack into the network people.People make unintentional mistakes.People do not know about cybersecurity protocols

Learn more about Cybersecurity from

https://brainly.com/question/12010892

#SPJ1

_____ is a basic required Hypertext Markup Language (HTML) element. Group of answer choices

Answers

Answer:

header

title

nav

main

Explanation:

An HTML element is a component of an HTML document that tells a web browser how to structure and interpret a part of a HTML document. so without the basic element the browser will not be well structured

"Use onblur and onfocus to add red borders to the input elements when the user leaves without any input, and a green border if a value is typed and the user is done with the input element."
Was an instruction in my java assignment, does anyone have an idea on what code is needed to do that?

Answers

Answer:

habla en español no te entiendo por favor

Other Questions
A baseball field is a square with sides of length 90 feet. What is theshortest distance between first base and third base?A.90B.180 squaredC.90D.16200 squared a is a common factor of 72 and 108b is common multiple of 4 and 10work out the highest possible value of a/b Push factors of migration include all of the following, except Compare and contrast traditional falaj with modern irrigation system of uae I am 6 foot and 4 inches what is my height in metres?12 inches=to 1 foot and 1 foot=to 30 cm Hey can anyone pls write a pragraph about your family Directions: In this last section, you will answer one problem. Be sure to read theproblem carefully and to answer the question completely. Show your work and circleyour answer. Use any method to solve this problem.74. A restaurant has a total of 60 tables. Some of the tables can seat 4 people and someseat 2 people. All of the seats are occupied when there are 160 people seated. How mantables for 4 are there? Indicate whether the statement makes sense or not.Tenemos que comer porque acabamos de comer.a) sb) no I give brainliest if you help me with poemDirections: Choose one of the books that you read for your book reviews. Create a found poem on a passage from that book. Here's how:1. Carefully reread the text you have chosen, and look for 50100 words that stand out in the prose passage. Highlight or underline details, words, and phrases that you find powerful, moving, or interesting.2. On another sheet of paper, make a list of the details, words and phrases you underlined, keeping them in the order that you found them. Skip a line between the words so that they are easy to work with.3. Look back over your list and cut out everything that is dull, or unnecessary, or that just doesnt seem right for the poem. Try to cut your original list in half, so that you have 2550 words.4. Make any minor changes necessary to create your poem. You can change punctuation and make little changes to the words to make them fit together (such as change the tenses, possessives, plurals, and capitalizations).5. When youre close to an edited-down version, if you absolutely need to add a word or two to make the poem flow more smoothly, to make sense, or to make a point, you may add up to two words of your own. Thats two (2) and only two!6. Read back over your edited draft one more time and make any deletions or minor changes.7. Check your words, and choose a title is there a better title than Found Poem?8. Copy the words and phrases into your journal or type them in a word processing program. Space or arrange the words so that they are poem - like. Pay attention to line breaks, layout, and other elements that will emphasize important words or significant ideas in the poem.Read aloud as you arrange the words! Test the possible line breaks by pausing slightly. If it sounds good, its probably right.Arrange the words so that they make a rhythm you like. You can space words out so that they are all alone or 'allruntogether.'You can also put key words on lines by themselves.9. At the bottom of the poem, tell where the words in the poem came from. For example, From Tales of a Fourth Grade Nothing, by Judy Blume.Original title1 pointPoem body2 pointsReference2 pointsGrading Scale5 points = A4 points = B3 points = C2 points = DInstructions adapted from Found and Headline Poems from Getting the Knack: 20 Poetry Writing Exercisesby Stephen Dunning and William Stafford. If a city with a population of 283,900 doubles in size every 66 years, what will the population be 198 years from now PLEASE HELP A large-scale work often performed during Lent, when opera was forbiddena. Hallelujah from MessiahA song for a solo vocalist in ABA formb. OratorioFamous piece for SATB chorusc. Da Capo Aria I NEED HELP LIKE ASAP50 points!!5. The table shows the number of stories in eightbuildings. Which statement is true?Table:15 15 18 20 22 24 26 40a. The mode is greater than the mean.b. There are no outiers.c. The mode best describes the data.d. The meon is greater than the median Think of a time you overcame a challenge or obstacle.Describe the experience in two to three sentences. Emily is trying to rewrite 45 - 27 as the product of the GCF of the two numbers anda difference. Will this work? Explain. A cylinder has a diameter of 10 inches in the height four times the radius what is the volume Which sentence uses humor in this excerpt from Charles Farrar Browne's "Interview with President Lincoln"? 1."Mr. Linkin, who do you spect I air?" sed I. 2."A orfice-seeker, to be sure," sed he. 3. "Wall, sir," sed I, "you's never more mistaken in your life. 5.I'm the father of Twins, and they look like me--BOTH OF THEM. 6.Repose in Abraham's Buzzum!" sed one of the orfice seekers (there are 3 qs? Which statement best describes how the British economy contributed to the Industrial Revolution beginning in Great Britain? A. Great Britain had an open economy that encouraged global trade in industrial technology. B. The British agricultural economy was so weak that businesses needed to industrialize. OC. Government leaders exercised strict economic control and demanded industrialization. D. The British economy featured banks and stock companies that invested in industrialization. Which detail from this excerpt highlights that Gus is a loyal, caring friend?[5] "Look at the monkey on a mule!"[6] Gus cared nothing for taunts and slurs against himself, but he deeply resented any suggestion of insult aimed at his crippled friend. However, although Bill could not defend his reputation with his fists, a method which most appealed to Gus, the lame boy had often proved that he had a native wit and a tongue that could give as good as was ever given him.[7] "Here we are, Gus, and how can I ever get square with you?" Bill said, his crutch and loot thumping the steps as the boys gained the doorway.[8] In answer to the bell, a sweet-faced lady opened the door, greeted the boys by name and ushered them into a book-lined study where already several other boys and girls of about the same age were gathered about their school teacher. If the volume of a cube is 64 cubic inches, find the length of one edge The predictable sequence of reactions (alarm, resistance, exhaustion) that organisms show in response to stressors defines the _____ Group of answer choices life events approach. general adaptation syndrome. biomedical approach. cognitive theory of stress.