Here is my solution. http://ideone.com/LW19fV
It produces the right answer sometimes, and other times, it messes it up. I have a few questions about this problem.
In the tutorial, it says: ...So we need to sort all available students in the order of increasing fj and try to feed 0, 1, 2, ldots first students in this order. What are ldots? In my code, I did sort the students in order of increasing food need, and code feeds as many as is possible per day.
Finally, could someone please look through my code, and tell me where I am messing up? The solving part is in the function called "Solve()" (duh).