Google Code Jam 2013 Round 1a Bullseye challenge is to determine how many full rings can be painted given an initial radius and an amount of paint.
Given a radius r, central white zone, create black rings of width 1 cm separated by 1 cm given P ml of paint that covers pi sq-cm per ml of paint provided.
The test cases are a few from the 6000 in the Large number set. In contest mode the player has 8 minutes to submit a response after downloading the data set.
Input: [r, p] uint64, 1<=r<=1E18, 1<=P<=2E18. Always enough P for one ring
Output: Rings
Examples:
[1 9] 1; % Normal number examples to understand concept [1 10] 2; [3 40] 3;
[1 1000000000000000000] 707106780 for Bullseye Large Number Challenge [1 2000000000000000000] 999999999 [760961177192651897 1521922354385303795] 1
Google Code Jam:
The next competition starts in April 2014. See details from above link.
Solutions to the various past Challenges using Matlab can be found via GJam Solutions.
Large number solutions require more elegant methods to avoid time-outs.
Related Challenges:
Usage of regexp is verboten
Does r=uint64(308436464205151562) make sense? It seems like the argument to uint64 is a double precision number, so you have already lost the precision you are trying to gain by using uint64.
r=uint64(308436464205151562) outputs for uint64(r) 308436464205151562. However, r=308436464205151562 outputs for uint64(r) 308436464205151552. A very small loss in precision, but still a loss. The Challenge set has some numbers that use all the paint if full precision math was used. If residual paint was required as an output then full precision is needed. For solutions using p=p-2*r-1 the errors in r and p may cause issues.
Very novel input parameter adjustment to allow direct solution.
Nice bisecting search method and anonymous function for clean appearance.
193 Solvers
2465 Solvers
37 Solvers
Remove from a 2-D matrix all the rows that contain at least one element less than or equal to 4
122 Solvers
Diophantine Equations (Inspired by Project Euler, problem 66)
28 Solvers