Pagini recente » Cod sursa (job #2123713) | Cod sursa (job #2296522) | Cod sursa (job #3203998) | Cod sursa (job #2952103) | Cod sursa (job #22786)
Cod sursa(job #22786)
#include <fstream.h>
#include <math.h>
unsigned int n, i, v1[100], v2[100], v3[100], j, l=1, k=1;
float x, y, m, o, nr=0;
int main()
{
ifstream f("patrate3.in");
f>>n;
for(i=1; i<=n; i++)
{f>>x;
f>>y;
v1[l]=x;
v2[l]=y;
l++;
}
for(i=1; i<=l; i++)
for(j=1;j<=l; j++)
{v3[k]=sqrt((v2[i]-v1[i])*(v2[i]-v1[i])+(v2[j]-v1[j])*(v2[j]-v2[j]));
k++;
}
for(i=1; i<=k; i++)
for(j=i; j<=k; j++)
for(m=j; m<=k; m++)
for(o=m; o<=k; o++)
{if((v3[i]==v3[j])&&(v3[j]==v3[m])&&(v3[m]==v3[o]))
nr++; }
ofstream g("patrate3.out");
g<<nr;
f.close();
g.close();
return 0;
}