Solutions to fair distribution programming problems : <p>I have run into a wall since I attended a coding contest. I think this problem falls into the category of fair distribution, but I am not sure.
I am attaching the problem <a href="http://pastebin.com/xd3eywKj" rel="nofollow noreferrer">here</a>.</p>

<p>I have come out with an empirical formula so which I tested successfully for 3 iterations attached <a href="http://pastebin.com/t9JyrUce" rel="nofollow noreferrer">here</a>.</p>

<p>I am unable to come up with a working code that can solve this programming problem. Any help is appreciated.</p>
