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

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:

1) Reading 64 bit input file

2) Bullseye Regular Numbers

Usage of regexp is verboten

Solution Stats

40.0% Correct | 60.0% Incorrect
Last Solution submitted on May 28, 2021

Problem Comments

Solution Comments

Show comments

Problem Recent Solvers8

Suggested Problems

More from this Author296

Community Treasure Hunt

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

Start Hunting!