You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We call a square valid on a 2d coordinate plane if it satisfies the following conditions:
3
+
4
+
Area of the square should be equal to 1.
5
+
All vertices of the square have integer coordinates.
6
+
All vertices of square lie inside or on the circle of radius r, centered at origin.
7
+
Given the radius of circle r, count the number of different valid squares. Two squares are different if atleast one of the vertices of first square is not a vertex of second square.
8
+
9
+
Input Format
10
+
The first line contains the integer r, the radius of the circle.
11
+
12
+
Constraints
13
+
1 <= r <= 2 * 10^5
14
+
Use a 64-bit integer type (like long long in C++ or long in Java) for sum calculations to prevent overflow.
15
+
16
+
Output Format
17
+
Print the number of different squares in this circle of radius r.
18
+
19
+
Sample Input 1
20
+
Sample Output 0"""
21
+
22
+
# Title: Count Axis-Aligned Unit Squares in Circle
23
+
# Description: Counts the number of squares with area 1, integer vertices, fully inside a circle of radius r.
0 commit comments