Circle Lattice Points

AtCoder
IDabc191_d
Time2000ms
Memory256MB
Difficulty
We have a circle of radius $R$ centered at $(X, Y)$. Find the number of grid points (points whose $x$\- and $y$\-coordinates are both integers) within or on the circle. ## Constraints * $|X| \le 10^5$ * $|Y| \le 10^5$ * $0 \lt R \le 10^5$ * Each of $X$, $Y$, and $R$ has at most four digits after the decimal point. ## Input Input is given from Standard Input in the following format: $X$ $Y$ $R$ [samples]
Samples
Input #1
0.2 0.8 1.1
Output #1
3

The circle is shown below. The grid points within or on the circle are marked red.
![image](https://img.atcoder.jp/ghi/4f37b99cfbdbb337043b16d8ce64571c.png)
Input #2
100 100 1
Output #2
5

$X$, $Y$, and $R$ may not have decimal points. Note that we also count the grid points on the circle.
Input #3
42782.4720 31949.0192 99999.99
Output #3
31415920098
API Response (JSON)
{
  "problem": {
    "name": "Circle Lattice Points",
    "description": {
      "content": "We have a circle of radius $R$ centered at $(X, Y)$.   Find the number of grid points (points whose $x$\\- and $y$\\-coordinates are both integers) within or on the circle.",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "abc191_d"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "We have a circle of radius $R$ centered at $(X, Y)$.  \nFind the number of grid points (points whose $x$\\- and $y$\\-coordinates are both integers) within or on the circle.\n\n## Constraints\n\n*   $|X| \\le...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments