A certain number of men can do a certain piece of work in D days. If there were m more men engaged in the work then the work can be done in d days less. The task is to find how many men were there initially.
Input: D = 5, m = 4, d = 4
Input: D = 180, m = 30, d = 20
Approach: Let the initial number of men be M and days be D
Amount of work completed M men in D days will be M * D
i.e. Work Done = M * D …(1)
If there are M + m men then the same amount of work is completed in D – d days.
i.e. Work Done = (M + m) * (D – d) …(2)
Equating equations 1 and 2,
M * D = (M + m) * (D – d)
M * D = M * (D – d) + m * (D – d)
M * D – M * (D – d) = m * (D – d)
M * (D – (D – d)) = m * (D – d)
M = m * (D – d) / d
Below is the implementation of the above approach:
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Total ways of choosing X men and Y women from a total of M men and W women
- Total ways of selecting a group of X men from N men with or without including a particular man
- Ways of selecting men and women from a group to make a team
- C/C++ Program to Find the Number Occurring Odd Number of Times
- Program to find last digit of n'th Fibonnaci Number
- C program to find Decagonal Number
- Program to find Cullen Number
- Program to find Star number
- Puzzle | Program to find number of squares in a chessboard
- Program to find remainder when large number is divided by 11
- Program to find last two digits of Nth Fibonacci number
- Program to find the number of region in Planar Graph
- C++ Program to find sum of even factors of a number
- Program to find number of solutions in Quadratic Equation
- Program to find the nth Kynea number
- Program to find total number of edges in a Complete Graph
- Program to find the Hidden Number
- Program to find the Nth Harmonic Number
- Program to find remainder when large number is divided by r
- Program to find minimum number of lectures to attend to maintain 75%
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.