firstly, i write this code:
int X, Y;
for (i=0; i<N; i++)
{
printf("Enter X and Y: ");
scanf("%d %d", &X, &Y);
}
int A[X][Y];
for (int i=0;i<X;i++){
for (int j=0;j<Y;j++){
printf("A[i][j]:");
scanf("%d", &A[i][j]);
}
}
but, I have trouble with the calculation I couldn’t improve it.
What you appear to be looking for is the furthest neighbour between points. Writing a brute force solution is trivial, just compare distances between every possible pair of points. As per the link, far better solutions exist.
Edit: Distance between two points is