Pagini recente » Cod sursa (job #2725792) | Cod sursa (job #1273761) | Cod sursa (job #409381) | Cod sursa (job #1612861) | Cod sursa (job #530023)
Cod sursa(job #530023)
// pb067.cpp : Defines the entry point for the console application.
//
//#include "stdafx.h"
#include "stdio.h"
#include "math.h"
typedef struct _TPOINT
{
double x;
double y;
} POINT;
int main()
{
FILE *f = fopen("triang.in", "rt");
FILE *fres = fopen("triang.out", "wt");
int n = 0, i = 0, j = 0;
fscanf(f, "%d", &n);
POINT p;
POINT lpoints[1501];
double mDist[1501][1501] = { 0 };
/*for (i = 0; i < n; i++)
{
fscanf(f, "%lf%lf", &p.x, &p.y);
lpoints[i].x = p.x;
lpoints[i].y = p.y;
for (j = 0; j < i; j++)
{
double d = sqrt((lpoints[i].x - p.x) * (lpoints[i].x - p.x) + (lpoints[i].y - p.y) * (lpoints[i].y - p.y));
mDist[i][j] = d;
}
}
int k = 0, tr = 0;
for (i = 1; i < n; i++)
{
for (j = i; j < n; j++)
{
for (k = j + 1; k < n; k++)
if (mDist[i][j] == mDist[i][k] && mDist[i][j] == mDist[i + k - j][k])
tr++;
}
}
fprintf(fres, "%d", tr);*/
fclose(fres);
fclose(f);
return 0;
}