Ethan is the leader of a team with N members. He has assigned an error score to each member in his team based on

Answered step by step
Verified Expert Solution
Question
95 users unlocked this solution today!

image

image


Ethan is the leader of a team with N members. He has assigned an error score to each member in his team based on the bugs that he has found in that particular team member's task. Because the error score has increased to a significantly large value, he wants to give all the team members a chance to improve their error scores, thereby improving their reputation in the organization. He introduces a new rule that whenever a team member completes a project successfully, the error score of that member decreases by a count P and the error score of all the other team members whose score is greater than zero decreases by a count Q. Write an algorithm to help Ethan find the minimum number of projects that the team must complete in order to make the error score of all the team members zero. Input The first line of the input consists of an integer- errorScore_size, representing the total number of team members (N). The second line consists of N space-separated integers- errorScore, representing the Initial error scores of the team members. The third line consists of an integer- compP, representing the count by which the error score of the team member who completes a project successfully decreases (P). The last line consists of an integer- othQ, representing the count by which the error score of the team member whose error score is greater than zero decreases (Q), Output Print an integer representing the minimum number of projects that the team must complete in order to make the error score of all the team members zero. If no project need to be completed then print 0. Constraints 1 errorScore_size 2*105 1 othQ compP 10 3 0 errorScore 10 Note team member whose error score is greater than zero decreases (Q). Output Print an integer representing the minimum number of projects that the team must complete in order to make the error score of all the team members zero. If no project need to be completed then print 0. Constraints 1 errorScore sizes 2*40 1 othQ comop 109 0 errorScores 10 Note The error score of any team member can never be less than zero. Example Input: 3 641 Output: Explanation: Firstly, the first team member completes a project successfully, the updated error score of the team members will be: 2 30. Then, when a second member completes a project successfully, the updated error score of the team members will be: 100. Then, when the first member completes another project successfully, the updated score of the team members will be: 0 0 0. So, the team needs to complete 3 projects to make the error score of all the team members zero.

Step by Step Solution

3.47 Rating (154 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Link Copied!

Step: 1

Here is the solution for the given question Algorithm to solve the given problem 1 Read the input va... View full answer

blur-text-image
Question Has Been Solved by an Expert!

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

100% Satisfaction Guaranteed-or Get a Refund!

Step: 2Unlock detailed examples and clear explanations to master concepts

blur-text-image_2

Step: 3Unlock to practice, ask and learn with real-world examples

blur-text-image_3

See step-by-step solutions with expert insights and AI powered tools for academic success

  • tick Icon Access 30 Million+ textbook solutions.
  • tick Icon Ask unlimited questions from AI Tutors.
  • tick Icon Order free textbooks.
  • tick Icon 100% Satisfaction Guaranteed-or Get a Refund!

Claim Your Hoodie Now!

Recommended Textbook for

Physics

Authors: David Young, Shane Stadler

10th edition

1118486897, 978-1118836873, 1118836871, 978-1118899205, 1118899202, 978-1118486894

More Books
flashcard-anime

Study Smart with AI Flashcards

Access a vast library of flashcards, create your own, and experience a game-changing transformation in how you learn and retain knowledge

Explore Flashcards

Students Have Also Explored These Related Programming Questions!