Mai intai trebuie sa te autentifici.
Cod sursa(job #2755873)
| Utilizator | Data | 28 mai 2021 17:09:51 | |
|---|---|---|---|
| Problema | Patrate 3 | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva de probleme | Marime | 0.88 kb |
#include<bits/stdc++.h>
using namespace std;
ifstream f("patrate3.in");
ofstream g("patrate3.out");
int main(){
int n,i,count=0;
long long distantaX,distantaY;
float x1,y1;
set<pair<int,int> >set;
pair<int,int>
pereche1,pereche2;
f>>n;
for(i=0;i<n;++i){
f>>x1>>y1;
x1=round(x1*10000);
y1=round(y1*10000);
set.insert(make_pair(x1,y1));
}
for(auto x:set)
for(auto y:set){
if(x!=y){
distantaX=x.second-y.second;
distantaY=y.first-x.first;
pereche1=make_pair(distantaX+x.first,distantaY+x.second);
pereche2=make_pair(distantaX+y.first,distantaY+y.second);
if(set.find(pereche1)!=set.end() && set.find(pereche2)!=set.end()){
++count;
}
}
}
g<<count/4;
return 0;
}