Pagini recente » Cod sursa (job #2806786) | Cod sursa (job #2543966) | Cod sursa (job #2807264) | Cod sursa (job #594456) | Cod sursa (job #899463)
Cod sursa(job #899463)
#include <fstream>
#include <cmath>
#include <algorithm>
#define eps 0.001
using namespace std;
inline double distanta (double a,double b,double c,double d)
{
double dist;
dist=sqrt((a-b)*(a-b)+(c-d)*(c-d));
return dist;
}
long int n,i,j,k,numar;
double a[1505],b[1505],r,t,z;
int main()
{
ifstream f("triang.in");
ofstream g("triang.out");
f>>n;
for (i=1;i<=n;i++)
f>>a[i]>>b[i];
numar=0;
for (i=1;i<=n-2;i++)
for (j=i+1;j<=n-1;j++) {
r=distanta(a[i],a[j],b[i],b[j]);
for (k=j+1;k<=n;k++) {
t=distanta(a[i],a[k],b[i],b[k]);
z=distanta(a[j],a[k],b[j],b[k]);
}
if (abs(r-t)<eps &&abs(r-z)<eps) numar++;
}
g<<numar;
f.close();
g.close();
return 0;
}