Please help, I have the written code but getting wrong answer
Prata spoj, need help
And send it using cb ide
This is the updated code. There were two errors in your code:
- To find the value of the upper bound on e, its value must be equal to (arr[0]p(p + 1))/2, only after the array has been sorted in decreasing order. This would be the maximum value.
- I your check function, while((y)<=m) , you used this step. You must use this as the condition for the while loop. while((y + x)<=m). This is because using this, you will be able to check whether a given step is feasible or not and then only increase the count of the paranthas.
Suggestion: You roots of a quadratic equation to find the number of paranthas cooked by a chef in a certain time limit. The while loop is quite time consuming.
If my explanation was able to answer your query, please mark the doubt as resolved.