[Haskell-beginners] GCJ 2015 - Round 1A Problem - Haircut
Doug McIlroy
doug at cs.dartmouth.edu
Sat Apr 18 14:29:11 UTC 2015
> Can someone tell me how I could have avoided or fixed this?
The trouble manifested as stack overflow on solving
> https://code.google.com/codejam/contest/4224486/dashboard#s=p1
For efficiency, you'll probably need more cleverness in math than
in Haskell. You can predict an approximate start time for the Nth
customer's service from the average per-customer service time M,
where 1/M = sum 1/M_k.
Starting from that estimate, one can skip over almost the entire
service simulation.
Doug McIlroy
More information about the Beginners
mailing list