class Solution {
static boolean check(int x1,int y1, int r, int x, int y)
{
if ((x - x1) * (x - x1) +
(y - y1) * (y - y1) <= r * r)
return true;
else
return false;
}
public int countLatticePoints(int[][] circles) {
int max1=-1;
int max2=-1;
for(int i=0;i<circles.length;i++)
{
max1=Math.max(max1,circles[i][0]+circles[i][2]);
max2=Math.max(max2,circles[i][1]+circles[i][2]);
}
// int umax=Math.max(max1)
int x=0;
int y=0;
int count=0;
for(int i=0;i<=max2;i++)
{
for(int j=0;j<=max1;j++)
{
x=j;y=i;
for(int k=0;k<circles.length;k++)
{
if(check(circles[k][0],circles[k][1],circles[k][2],x,y)==true)
{
count++;
break;
}
}
}
}
return count;
}
}