Pagini recente » Cod sursa (job #2474034) | Cod sursa (job #2389799) | Cod sursa (job #3153885) | Cod sursa (job #1029798) | Cod sursa (job #7263)
Cod sursa(job #7263)
#include<fstream.h>
#include<float.h>
#include<math.h>
ifstream f("patrate3.in");
ofstream g("patrate3.out");
int main(){
long n,nr=0,i,i1,i2,i3,j=-1,j1,e;
float v[1002][2];
long p[10000];
f>>n;
for(i=1;i<=n;i++){f>>v[i][0];f>>v[i][1];}
for(i=1;i<=n;i++)
for(i1=1;i1<=n;i1++)
for(i2=1;i2<=n;i2++)
for(i3=1;i3<=n;i3++){
e=0;
for(j1=0;j1<=j;j1++){if(p[j1]==i*i1*i2*i3) e=1; if(e==1) break;}
if(e==0){p[++j]=i*i1*i2*i3;
if(sqrt(pow(abs(v[i][0]-v[i1][0]),2)+pow(abs(v[i][1]-v[i1][1]),2)) ==sqrt(pow(abs(v[i2][0]-v[i3][0]),2)+pow(abs(v[i2][1]-v[i3][1]),2))|| sqrt(pow(abs(v[i][0]-v[i2][0]),2)+pow(abs(v[i][1]-v[i2][1]),2)) ==sqrt(pow(abs(v[i1][0]-v[i3][0]),2)+pow(abs(v[i1][1]-v[i3][1]),2))|| sqrt(pow(abs(v[i][0]-v[i3][0]),2)+pow(abs(v[i][1]-v[i3][1]),2)) ==sqrt(pow(abs(v[i1][0]-v[i2][0]),2)+pow(abs(v[i1][1]-v[i2][1]),2)))
nr++;
}
}
g<<nr/10;
f.close();g.close();return 0;}