eolymp
bolt
Try our new interface for solving problems
Problems

Counting Pixels

Counting Pixels

Did you know that if you draw a circle that fi lls the screen on your \textbf{1080p} high de nition display, almost a million pixels are lit? That's a lot of pixels! But do you know \textit{exactly} how many pixels are lit? Let's fi nd out! Assume that our display is set on a Cartesian grid where every pixel is a perfect unit square. For example, one pixel occupies the area of a square with corners (\textbf{0}, \textbf{0}) and (\textbf{1}, \textbf{1}). A circle can be drawn by specifying its center in grid coordinates and its radius. On our display, a pixel is lit if any part of is covered by the circle being drawn; pixels whose edge or corner are just touched by the circle, however, are not lit. \includegraphics{https://static.e-olymp.com/content/d3/d31f5ee92c82798376f450d9ae84a041bc4d668c.jpg} Your job is to compute the exact number of pixels that are lit when a circle with a given position and radius is drawn. \InputFile The input consists of several test cases, each on a separate line. Each test case consists of three integers, \textbf{x}, \textbf{y}, and \textbf{r}(\textbf{1} ≤ \textbf{x}, \textbf{y}, \textbf{r} ≤ \textbf{10^6}), specifying respectively the center (\textbf{x}, \textbf{y}) and radius of the circle drawn. Input is followed by a single line with \textbf{x = y = r = 0}, which should not be processed. \OutputFile For each test case, output on a single line the number of pixels that are lit when the speci ed circle is drawn. Assume that the entire circle will fi t within the area of the display.
Time limit 1 second
Memory limit 64 MiB
Input example #1
1 1 1
5 2 5
0 0 0
Output example #1
4
88