Topcoder SRM 456

Today I took part in another Topcoder SRM — only a week after the previous one.  I hadn’t competed in any since March, and now there were two in the space of a week.

Anyway, the competition this time was fairly easy, so it seems like they were (over-)compensating from the hard tournament last week.  The first problem was literally 6 lines of code.  I’m interested to see the solution to the second — most of the solutions I saw were binary search algorithms that would narrow it down to an answer, which seemed very unsatisfactory to me.  (And by the way, one trick I learned from this competition, that in retrospect should have been more obvious, is that when you do a binary search with a fixed starting range and a fixed precision target, it’s better to just hardcode the number of iterations it will take rather than testing that the precision is smaller than the target — this avoids any possible floating point issues.)

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: