This is the problem statement
An Indian farmer has a piece of farmland, say L square kilometers long, and wants to either sow wheat or rice or a combination of both. The farmer has a limited amount of F kg of fertilizer and P kg of insecticides.
Every square kilometre of wheat requires F1 Kg of fertilizer and P1 Kg of insecticide. Every square kilometre of rice farming requires F2 Kg of fertilizer and P2 Kg of insecticide. Let S1 be the price obtained by selling wheat harvested from a square kilometre and S2 be the price obtained by selling rice harvested from a square kilometre.
You have to find the maximum total profit that the farmer can earn by selecting the area in which wheat and/or rice should be farmed.
For example:
L = 10 Km2 , F = 10 Kg, P = 5 Kg, F1 = 2 Kg, P1 = 2 Kg, F2 = 3 Kg, P2 = 1 Kg, S1 = 14 , S2 = 25.
In this case, the farmer will earn a maximum profit if he sows only Rice on 3.33
Km2 area and maximum profit value will be 83.33
.
Input Format
The only of input will consist of 9 integers space-separated, L, F, P, F1, P1, F2, P2, S1, S2
Constraints
1 <= L <= 10^4
1 <= F <= 10^4
1 <= P <= 10^4
F1 + F2< = F
P1 + P2 <= P
1 <= S1 <= 10^4
1 <= S2 <= 10^4
Output Format
Output will be
- Maximum profit correct up-to 2 digits
- value in km 2 where wheat should be planted correct up-to 2 digits
- value in km 2 where rice should be planted correct up-to 2 digits.
For the example considered in the question output will be 83.33 0.00 3.33
.
Sample Test Case
Input
10 10 5 2 2 3 1 14 25
Output
83.33 0.00 3.33
Explanation
let us say that L = 10 Km2 , F = 10 Kg, P = 5 Kg, F1 = 2 Kg, P1 = 2 Kg, F2 = 3 Kg, P2 = 1 Kg, S1 = 14 , S2 = 25 . Total profit will be maximum if farmer does not plant any wheat but plants rice on 3.33 km2 area and maximum profit value is 83.33 .
I require a solution to this problem. However, unable to grasp the statement itself. Please help me.