Madara and Push-Ups
Practice
5 (2 votes)
Implementation
Easy
Simple Math
Problem
74% Success 447 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code

Madara, as you know, is not generally a person to work-out. But recently his girlfriend told him to get in shape. So he started going to the gym everyday.

He knows that he must do at least N number of push-ups in a day. If he is unable to do N push-ups altogether, he does them in different sets. He knows he can do at max A push-ups in the same set. Every time he does a set, he becomes a little tired and hence does D number of push-ups less in the next set. But no matter how tired he gets, he is capable of doing M number of push-ups at the least.

What is the minimum number of sets in which Madara can complete his daily goal?

INPUT:

The first line contains an Integer T, the number of test cases. Each test case consists of four integers - N, A, D and M.

OUTPUT:

For each test case, output an single Integer denoting the minimum number of sets on a new line.

CONSTRAINTS:

1 <= T <= 100

1 <= A, N <=1000

1 <= D <= 500

5 <= M <= 100

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
1 votes
Tags:
MathematicsEasyMathematicsMathamatics
Points:20
3 votes
Points:20
11 votes
Tags:
Basic ProgrammingOpenApprovedEasyMathamatics