Pagini recente » Rating DELETED (deleted_8906cfc5790da986) | Cod sursa (job #3275024) | Istoria paginii summer-challenge-2007/solutii/runda-1 | Cod sursa (job #2852579) | Cod sursa (job #3285945)
#include <bits/stdc++.h>
using namespace std;
ifstream fin ("triang.in");
ofstream fout ("triang.out");
const double dif = 1e-3;
int N, rez;
struct punct {
double x;
double y;
bool operator < (const punct& a) const{
if ( abs(x - a.x) > dif )
return x < a.x;
if ( abs(y - a.y) > dif )
return y > a.y;
return 0;
}
} puncte[1505];
set <punct> s;
punct rotatie ( punct a, punct b ) {
double cos = 1.0 / 2;
double sin = sqrt(3) / 2;
punct c;
c.x = a.x + ( b.x - a.x ) * cos - ( b.y - a.y) * sin;
c.y = a.y + ( b.x - a.x ) * sin + ( b.y - a.y) * cos;
return c;
}
int main() {
fin >> N;
for ( int i = 1; i <= N; ++ i ) {
fin >> puncte[i].x >> puncte[i].y;
for ( int j = 1; j < N; ++ j ) {
if ( s.find(rotatie(puncte[i], puncte[j])) != s.end() ) {
rez ++;
}
}
s.insert(puncte[i]);
}
fout << rez;
}