Pagini recente » Cod sursa (job #2204968) | Cod sursa (job #2344689) | Cod sursa (job #85486) | Cod sursa (job #2707409) | Cod sursa (job #2545728)
#include <bits/stdc++.h>
#define x first
#define y second
using namespace std;
int main(){
ifstream cin("triang.in");
ofstream cout("triang.out");
int n, ans = 0;
double eq = 0.001, hp1, hp2, hp3, hp4, hp5;
cin >> n;
vector<pair<double, double> > v(n);
for(int i = 0; i < n; ++i)
cin >> v[i].x >> v[i].y;
for(int i = 0; i < n; ++i){
for(int j = i + 1; j < n; ++j){
for(int k = j + 1; k < n; ++k){
hp1 = v[i].x - v[j].x;
hp2 = v[i].y - v[j].y;
hp3 = (hp1 * hp1) + (hp2 * hp2);
hp1 = v[i].x - v[k].x;
hp2 = v[i].y - v[k].y;
hp4 = (hp1 * hp1) + (hp2 * hp2);
hp1 = v[j].x - v[k].x;
hp2 = v[j].y - v[k].y;
hp5 = (hp1 * hp1) + (hp2 * hp2);
if((abs(hp3 - hp4) < eq) && (abs(hp3 - hp5) < eq) && (abs(hp4 - hp5) < eq))
++ans;
}
}
}
cout << ans << '\n';
cin.close(), cout.close();
}