Solution for USACO problem "Barn Repair"

Greedy method.
1. pick one board long enough to cover all cows in stalls
2. cut the board at the position where longest continuous stalls without
cows in them
3. repeat step2 until reach the limitation of boards can be purchased or
there is no available continuous stalls without cows