Answered step by step
Verified Expert Solution
Link Copied!
Question
1 Approved Answer

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

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

Step: 1

Here is the solution for the given question Algorithm to solve the given problem 1 Read the input va... blur-text-image
Get Instant Access to Expert-Tailored Solutions

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

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Physics

Authors: David Young, Shane Stadler

10th edition

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

More Books

Students explore these related Programming questions