Circle and Lattice Points
Submissions: 1384   Accuracy:

60.86%

  Difficulty: Easy   Marks: 2

Given a circle of radius R in 2-D with origin of (0, 0) as center. The task is to find the total lattice points on circumference. Lattice Points are points with coordinates as integers in 2-D space.

Example:

Input: R = 5

Output: 12

Explanation:

Below are lattice points on a circle with
radius 5 and origin as (0, 0).
(0,5), (0,-5), (5,0), (-5,0), (3,4), (-3,4),
(-3,-4), (3,-4), (4,3), (-4,3), (-4,-3), (4,-3).
Total 12 lattice points.

 

Input:

The first line of input contains T denoting the no. of test cases . Then T test cases follow . The first line of each test case contains an Integer R which will be the radius of the circle.


Output:

For each test case output the required result in a new line.


Constraints:

1<=T<=100
1<=R<=100
Example:

Input:

2

5

88

 

Output:

12

4

** For More Input/Output Examples Use 'Expected Output' option **

Author: shubhbaranwal


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.


to report an issue on this page.