Problem 1732. GJam: 2013 Rd1a Bullseye Painting - Large Numbers

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


[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:

1) Reading 64 bit input file

2) Bullseye Regular Numbers

Usage of regexp is verboten

Solution Stats

27.78% Correct | 72.22% Incorrect
Last solution submitted on Jan 10, 2017

Problem Comments

Solution Comments

Discover MakerZone

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

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!