Please write a program in Python code for the following      John is taking n courses this semester, numbered from 1 to n. Each of these courses has a final exam. These exams are all held on the same day. John has d days left to study for the exams. In each of these days, he has exactly h hours of free time he can use to study (note that h might be greater than 24 as John lives in a different universe with a different time system). Moreover, for the i-th course John is taking, he has a learning rate l[i] indicating the number of marks he gets on the exam per hour of studying for that course. John studies for his exams in 1 hour blocks; for example, he can't study for an exam for 40 minutes then switch to another one. Note that in John's universe, final exam grades aren't capped at 100. In fact, there's no upper limit on how high they can go. If John takes an exam without studying for it, he'll get a 0 on that exam. In order to qualify for a nice scholarship, John needs to get at least m marks on each of the n exams. Help him out by telling him whether it's possible to do so if he manages his time wisely. ## Input - The first line contains a single integer t denoting the number of test cases.   The description of the t test cases follow one by one. - Each test case is described in 2 lines. The first line contains   4 space-separated integers n, d, h, and m, respectively. - The second line contains n space-separated integers, specifying the list l. ## Output For each test case, print "Yes" if John can qualify for the scholarship and "No" otherwise. Print these one per line, in the same order that the test cases appear in the input. ## Constraints - 1 <= t <= 5 - 1 <= n <= 1000 - 1 <= d <= 100 - 0 <= h <= 10**12 - 0 <= m <= 10**9 - 1 <= l[i] <= 10**9 ## Sample Input ``` 3 3 3 2 50 25 62 20 5 8 3 60 11 61 9 33 29 2 1 2 50 49 51 ``` ## Sample Output ``` Yes Yes No

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Please write a program in Python code for the following 

 

 

John is taking n courses this semester, numbered from 1 to n.
Each of these courses has a final exam. These exams
are all held on the same day.

John has d days left to study for the exams. In each of these days,
he has exactly h hours of free time he can use to study (note that
h might be greater than 24 as John lives in a different universe with
a different time system).

Moreover, for the i-th course John is taking,
he has a learning rate l[i] indicating the number of marks he gets
on the exam per hour of studying for that course.
John studies for his exams in 1 hour blocks; for example,
he can't study for an exam for 40 minutes then switch to another one.

Note that in John's universe, final exam grades aren't
capped at 100. In fact, there's no upper limit on how high they can go.

If John takes an exam without studying for it, he'll get a 0 on that exam.

In order to qualify for a nice scholarship, John needs
to get at least m marks on each of the n exams. Help him out by telling
him whether it's possible to do so if he manages his time wisely.


## Input

- The first line contains a single integer t denoting the number of test cases.
  The description of the t test cases follow one by one.
- Each test case is described in 2 lines. The first line contains
  4 space-separated integers n, d, h, and m, respectively.
- The second line contains n space-separated integers, specifying the list l.


## Output

For each test case, print "Yes" if John can qualify
for the scholarship and "No" otherwise. Print these one per line, in the same order
that the test cases appear in the input.


## Constraints

- 1 <= t <= 5
- 1 <= n <= 1000
- 1 <= d <= 100
- 0 <= h <= 10**12
- 0 <= m <= 10**9
- 1 <= l[i] <= 10**9

## Sample Input

```
3
3 3 2 50
25 62 20
5 8 3 60
11 61 9 33 29
2 1 2 50
49 51
```

## Sample Output

```
Yes
Yes
No
```

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Random Class and its operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education