Pagini recente » Clasamentul arhivei de probleme | Cod sursa (job #3274210) | Borderou de evaluare (job #486512) | Borderou de evaluare (job #2795686) | Cod sursa (job #915885)
Cod sursa(job #915885)
#include <stdio.h>
#include <math.h>
using namespace std;
int n,RES=0;
struct dpoint
{
double x,y;
}p[1500];
double dist(double x1,double y1,double x2,double y2)
{
return sqrt( (x1-x2)*(x1-x2) + (y1-y2)*(y1-y2) );
}
void _read()
{
freopen("triang.in","r",stdin);
freopen("triang.out","w",stdout);
scanf("%d",&n);
for(int i=0;i<n;i++)
scanf("%lf %lf",&p[i].x,&p[i].y);
}
int main()
{
_read();
int i,j,k;
for( i=0;i<n;i++)
for( j=i+1;j<n;j++)
for( k=j+1;k<n;k++)
{
if(dist( p[i].x,p[i].y,p[j].x,p[i].y) - dist( p[i].x,p[i].y,p[k].x,p[k].y) <= 0.001 )
if( dist(p[i].x,p[i].y,p[j].x,p[j].y) - dist(p[j].x,p[j].y,p[k].x,p[k].y) <= 0.001 )
RES++;
}
printf("%d",RES);
return 0;
}