Hello,

I have been stuck at this problem for a few days http://www.usaco.org/index.php?page=viewproblem2&cpid=991. I have seen the editorial but I don’t understand how they arrived at this formula:

long maxmatch = n - x*y;

long numdays = (maxmatch - g) / y + 1;

It is the consecutive number of days, such that y remains unchanged, please help me understand how to arrive at this formula. Thanks!