Discover MakerZone

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

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!

Problem 1730. GJam: 2013 Rd1a Bullseye Painting

Created by Richard Zapor

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.

Input: [r, p] Integer values, 1<=r,P<=1000. Always enough P for one ring

Output: Rings


[1 9] 1;
[1 10] 2;
[3 40] 3;
[1 1000000000000000000] 707106780 for Bullseye Large Number Challenge

Google Code Jam:

The next competition starts in April 2014. See details from above link.

This contest does not discriminate by age or against the superiority of Matlab, unlike ACM. Forty-seven Matlab contestants in GJam 2013 out of 21,273.

Solutions to the various past Challenges in Matlab can be found via GJam Solutions.

The Challenges have subsets with Large Number aspects which appear to favor C and Java. Binbin Qi is our last hope with his expertise in Matlab/Java BigInteger.

Related Challenges:

1) Reading 64 bit input file
2) Bullseye Large Numbers r<1E18, P<2E18

Usage of regexp is verboten


Problem Group

Solution Statistics

32 correct solutions 17 incorrect solutions
Last solution submitted on Dec 10, 2015