CF BUDDY
← Problems·

1971F · Circle Perimeter

1600 · binary search, brute force, dfs and similar

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

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

Input Format: The first line contains a single integer tt (1t10001 \leq t \leq 1000) — the number of test cases.

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

The sum of rr over all test cases does not exceed 10510^5.

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

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

Sample Cases

Case 1

Input

6
1
2
3
4
5
1984

Output

8
16
20
24
40
12504

Similar problems

00:00:00
Loading editor…
Welcome! I'm your coding tutor for this problem. Use the chips below to reveal stored hints or get AI feedback on your code. I'll guide you step by step — never giving away the solution.

Sign in to unlock AI tutor feedback