Pagini recente » Cod sursa (job #1735572) | Cod sursa (job #575015) | Cod sursa (job #2253093) | Cod sursa (job #2504346) | Cod sursa (job #3292197)
#include<fstream>
#include<set>
#include<cmath>
const std::string txt="patrate3";
std::ifstream cin(txt+".in");
std::ofstream cout(txt+".out");
struct mtcmt{
double x,y;
mtcmt(int a=0,int b=0){
x=a;y=b;}
bool operator<(const mtcmt &z) const{
return x<z.x || (x==z.x && y<z.y);
}
}v[1005];
std::set <mtcmt> u;
signed main(int n,int r,double x,double y){
cin>>n;
for(int i=1;i<=n;++i){
cin>>x>>y;
x=round(x*10000);
y=round(y*10000);
v[i]=mtcmt(x,y);
u.insert(v[i]);
}
r=0;
for(int i=1;i<n;++i){
for(int j=i+1;j<=n;++j){
int mx=(v[i].x+v[j].x)/2;
int my=(v[i].y+v[j].y)/2;
int cx=mx-v[i].x;
int cy=my-v[i].y;
mtcmt v1(mx-cy,my+cx);
mtcmt v2(mx+cy,my-cx);
if(u.find(v1)!=u.end() && u.find(v2)!=u.end())
++r;
}
}
cout<<r/2;
}