311341: CF1971F. Circle Perimeter

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:8 Solved:0

Description

F. Circle Perimetertime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

Given an integer $r$, find the number of lattice points that have a Euclidean distance from $(0, 0)$ greater than or equal to $r$ but strictly less than $r+1$.

A lattice point is a point with integer coordinates. The Euclidean distance from $(0, 0)$ to the point $(x,y)$ is $\sqrt{x^2 + y^2}$.

Input

The first line contains a single integer $t$ ($1 \leq t \leq 1000$) — the number of test cases.

The only line of each test case contains a single integer $r$ ($1 \leq r \leq 10^5$).

The sum of $r$ over all test cases does not exceed $10^5$.

Output

For each test case, output a single integer — the number of lattice points that have an Euclidean distance $d$ from $(0, 0)$ such that $r \leq d < r+1$.

ExampleInput
6
1
2
3
4
5
1984
Output
8
16
20
24
40
12504
Note

The points for the first three test cases are shown below.

Output

题目大意:
给定一个整数 $ r $,求有多少个格点(整数坐标点)与原点 (0, 0) 的欧几里得距离大于等于 $ r $ 但严格小于 $ r+1 $。

输入数据格式:
第一行包含一个整数 $ t $($ 1 \leq t \leq 1000 $)——测试用例的数量。
每个测试用例包含一行,有一个整数 $ r $($ 1 \leq r \leq 10^5 $)。
所有测试用例的 $ r $ 之和不超过 $ 10^5 $。

输出数据格式:
对于每个测试用例,输出一个整数——满足 $ r \leq d < r+1 $ 的格点数量,其中 $ d $ 是格点到原点 (0, 0) 的欧几里得距离。

注意:
欧几里得距离的计算公式为 $ \sqrt{x^2 + y^2} $。题目大意: 给定一个整数 $ r $,求有多少个格点(整数坐标点)与原点 (0, 0) 的欧几里得距离大于等于 $ r $ 但严格小于 $ r+1 $。 输入数据格式: 第一行包含一个整数 $ t $($ 1 \leq t \leq 1000 $)——测试用例的数量。 每个测试用例包含一行,有一个整数 $ r $($ 1 \leq r \leq 10^5 $)。 所有测试用例的 $ r $ 之和不超过 $ 10^5 $。 输出数据格式: 对于每个测试用例,输出一个整数——满足 $ r \leq d < r+1 $ 的格点数量,其中 $ d $ 是格点到原点 (0, 0) 的欧几里得距离。 注意: 欧几里得距离的计算公式为 $ \sqrt{x^2 + y^2} $。

加入题单

算法标签: