链接:https://www.nowcoder.com/acm/contest/90/E 来源:牛客网
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<stack>
#include<bitset>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>
#include<algorithm>
using namespace std;
typedef long long ll;
const double PI = acos(-1.0);
const double eps = 1e-6;
const int INF = 1000000000;
const int maxn = 100;
char str1[2000],s2[2000];
int dp[100005];
int T,n,count;
bool com(int a,int b)
{
return a<b;
}
bool ans(int n)
{
if(dp[1]==dp[n])
return true;
else
return false;
}
using namespace std;
typedef long long ll;
long long a[1005],b[1005];
struct pot{
int aa;
int bb;
long long cc;
}POT[500005];
int num[1005];
bool cmp(struct pot aaa,struct pot bbb)
{
if(aaa.cc!=bbb.cc)
return aaa.cc>bbb.cc;
else if(aaa.bb!=bbb.bb)
return aaa.aa<bbb.aa;
return aaa.bb<bbb.bb;
}
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
int n;scanf("%d",&n);
for(int i= 1;i<=n;i++)
{
scanf("%lld",&a[i]);
scanf("%lld",&b[i]);
}
int sum=0;int COUNT=0;
for(int i =1;i<=n;i++)
{
for(int j=i+1;j<=n;j++)
{
POT[COUNT].aa=i;
POT[COUNT].bb=j;
POT[COUNT].cc=(a[i]-a[j])*(a[i]-a[j])+(b[i]-b[j])*(b[i]-b[j]);
COUNT++;
{
}
}
}
sort(POT,POT+COUNT,cmp);
int tt=0;
for(int i = 0; i< COUNT;i++)
{
if(POT[i].cc==POT[i-1].cc)
{
if(num[POT[i].aa]==POT[i].cc||(num[POT[i].bb]==POT[i].cc))
{
tt++;
}
else
{
num[POT[i].aa]=POT[i].cc;
num[POT[i].bb]=POT[i].cc;
}
}
num[POT[i].aa]=POT[i].cc;
num[POT[i].bb]=POT[i].cc;
}
if(tt)
cout <<2*tt<<endl;
else
cout <<"WA"<<endl;
}
return 0;
}