Given coordinates, calculate whether can find a vertical line, so that the left and right sides of the point symmetry
Train of thought: The input process calculates the leftmost and the most right boundary, then calculates the midpoint value, then carries on the traversal to each point, if cannot find one point satisfies the x1+x2=mid*2&&y1==y2, then explained that, the direct break, if the traversal is complete, the explanation all conforms to the idea, Description You can find vertical bars.
Import Java.util.Scanner;
public class Main {
static int maxn = 1000;
static int[] x = new INT[MAXN+10];
static int[] y = new int[maxn+10];
static int mid,n;
public static void Main (string[] args) {
Scanner scan = new Scanner (system.in);
int t = Scan.nextint ();
while (T--! =0) {
n = scan.nextint ();
int lx = 0,RX = 0;
for (int i=0;i<n;i++) {
int a = Scan.nextint ();
Y[i] = Scan.nextint ();
X[i] = a*2;
if (X[I]<X[LX]) lx = i;
if (X[i]>x[rx]) Rx = i
}
MID = (X[lx]+x[rx])/2;
int i = 0;
for (; i<n;i++) {
if (!ishave (i)) {break
;
}
}
if (i>=n) {
System.out.println ("YES");
} else{
System.out.println ("NO");
}} public static Boolean ishave (int i) {for
(int j=0;j<n;j++) {
if (y[i]==y[j]&&x[i]+x[j]==2*mid) return true;
}
return false;
}
}