DCP-76: How Lazy one can be Back to All Problems

Medium Search Techniques > Binary Search/Bisection

**Techboy** is the laziest person on this planet. But his girl friend “you know who” does not like such indolence of Techboy . She orders him to complete **N** tasks in **M** days . If he fails to complete those tasks she will leave him for good. Techboy loves his girl so much that he will complete these tasks in M days but having the reputation of being the laziest person of this planet he wants to do minimum amount of unit work per day to complete N tasks in M days. If he starts doing a task there is no way to leave it incomplete for next day . He needs to complete it in that day. Can you help him to find the minimum unit of works he needs to do every day to complete N tasks in M days. **Note: He may choose tasks in any order he likes.** Input: ------ The first line contains an integer **T( 1<= T <= 101 )** which denotes the number of Test cases. T test cases follow . Each test Case will contain two lines of input . In first line there will be two intergers **N ( 2 <=N <=100 )** , **M ( 1<= M <= min(N,10) )** where N is the number of tasks and M is the deadline for these tasks to complete. Next line contains n integers ith **( 1 <= ith task <= 100 )** integer denotes the time Techboy needs to complete ith task. Output: ------- For each test case, print a line “**Case x: y**” where x is replaced by the test case number and y is the minimum unit work techboy needs to do per day to complete N tasks in M days. Sample Input ------------ 2 5 3 1 2 2 1 3 3 2 1 2 1 Sample Output ------------- Case 1: 3 Case 2: 2

Problem Setter:

Shakil Ahmed

Please login to submit solution to this problem.

Problem Limits

Language Time Limit (seconds)
C 1.00
C++ 1.00
C++14 1.00
C# 1.00
Go 1.00
Java 1.00
JavaScript 1.00
Objective-C 1.00
Perl 1.00
PHP 1.00
Python 1.00
Python3 1.00
Ruby 1.00
VB.Net 1.00

Problem Stats




# User Language Timing
01 twyu0721 Cpp 0.02s
02 shakilaust Cpp14 0.71s

Your feedback is our precious!

Or call +88 02 9853138 for support