Problem 1730. GJam: 2013 Rd1a Bullseye Painting

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

Examples:

[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

Solution Stats

57.89% Correct | 42.11% Incorrect
Last Solution submitted on Oct 30, 2022

Problem Comments

Solution Comments

Show comments

Problem Recent Solvers26

Suggested Problems

More from this Author308

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!