小明是真的爱平行四边形…
一道题做了两天,网上还没有题解,51Nod的解题报告还不给代码,就给一个简单的思路,然后说一句具体看代码,然后就没了???
我就想说,代码呢…
真的难…,总算是AC了这道题
直接上代码(本人代码写的不好,但是你可以偷偷的copy过去AC了再去查看别人的AC代码,因为毕竟只有AC用户才能查看别人的代码,因为写的比较烂,所以,请尽量不要看我的/wul)
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#define ios ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
typedef pair<double,double> PII;
typedef long long ll;
vector<PII>arr;
multiset<PII> alls;
int n,flag,loc,len;
double l,r,x,y;
double ans;
double zuhe(ll k)
{
return k*(k-1)/2;
}
int main()
{
ios;
cin>>n;
for(int i=0;i<n;++i)
{
cin>>l>>r;
arr.push_back({l,r});
}
for(int i=0;i<n;++i)
{
for(int j=i+1;j<n;++j)
{
flag=0;
x=(arr[i].first+arr[j].first)/2;
y=(arr[i].second+arr[j].second)/2;
// cout<<x<<" "<<y<<endl;
alls.insert({x,y});
}
}
multiset<PII>::iterator iter = alls.begin();
while (iter!=alls.end())
{
// cout<<(*iter).first<<" "<<(*iter).second<<endl;
ans+=zuhe(alls.count({(*iter).first,(*iter).second}))/alls.count({(*iter).first,(*iter).second});
iter++;
}
cout<<(ll)ans<<'\n';
return 0;
}