MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply Today**New to MATLAB?**

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**

5 correct solutions
12 incorrect solutions

Last solution submitted on Dec 13, 2014

1 Comment

Richard Zapor
on 22 Jul 2013

Very novel input parameter adjustment to allow direct solution.

1 Comment

Richard Zapor
on 22 Jul 2013

Nice bisecting search method and anonymous function for clean appearance.

2 Comments