Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C Programming Language Problem Title: All You Can Eat One day, Lili was invited to eat at all you can eat restaurant by Jojo and

C Programming Language

Problem Title: All You Can Eat

One day, Lili was invited to eat at all you can eat restaurant by Jojo and Bibi. This restaurant has N types of dish. Each dish has various happiness and weight. There are rules in restaurants that require every portion of food ordered must be finished by the person who ordered.

Lili who does not want to lose, wants to get a total happiness of at least M. Total hap- piness can be calculated by the sum of all happiness from the food eaten.

Lili does not want to eat too much (Due to being on diet). Because she doesnt want to be seen as glutton person, Lili will only take one portion of meal she chooses. Determine the minimum total weight of food that Lili should eats.

Format Input

Input consists of one integer T - number of test case. For each test case, there are two integers N and M. Then N lines follow, and each line contains a pair of integer Hi and Wi that describe the happiness and weight for each food.

Format Output

Output should be expressed in format Case #X: Y - X is the number of the query, and followed by one integer Y , minimum weight of food that should be consumed by Lili to reach the total happiness of M, or Impossible if there is no possible answer.

Constraints

1 T 5 1 N 18 1 M 1000000000 1 Hi , Wi 1000000000

Sample Input & Output (standard input & output)

2

3 7

4 2

4 3

3 2

Case #1: 4

1 4

1 1

Case #2: Impossible

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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

Step: 3

blur-text-image

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

Advanced Oracle Solaris 11 System Administration

Authors: Bill Calkins

1st Edition

0133007170, 9780133007176

More Books

Students also viewed these Databases questions

Question

dy dx Find the derivative of the function y=(4x+3)5(2x+1)2.

Answered: 1 week ago