Problems
Typical computer images are matrices of pixels, with each pixel being a small square of a specific color. Drawing lines that are not perfectly parallel to the axes of the pixel matrix results in imperfections. Drawing circles is an extreme example where those imperfections arise.
Suppose we have a picture consisting
of set_pixel_to_black(x, y) makes the
pixel at row
draw_circle_perimeter(R):
for x between -R and R, inclusive {
y = round(sqrt(R * R - x * x)) # round to nearest integer, breaking ties towards zero
set_pixel_to_black(x, y)
set_pixel_to_black(x, -y)
set_pixel_to_black(y, x)
set_pixel_to_black(-y, x)
}
Notice that some pixels may be set to black more than once by the code, but the operation is
idempotent (that is, calling set_pixel_to_black on a pixel that is already black changes
nothing).
The following is pseudocode for a function to draw a filled circle (starting from an all-white picture).
draw_circle_filled(R):
for x between -R and R, inclusive {
for y between -R and R, inclusive {
if round(sqrt(x * x + y * y)) <= R:
set_pixel_to_black(x, y)
}
}
And finally, the following is pseudocode to incorrectly draw a filled circle:
draw_circle_filled_wrong(R):
for r between 0 and R, inclusive {
draw_circle_perimeter(r)
}
Given draw_circle_filled(draw_circle_filled_wrong(
Input
The first line of the input gives the number of test cases,
Output
For each test case, output one line containing Case #,
where draw_circle_filled(draw_circle_filled_wrong(
Example
3
2
8
50
Case #1: 4
Case #2: 24
Case #3: 812