Cod sursa(job #530027)

Utilizator SilverMoonFeier Vlad SilverMoon Data 6 februarie 2011 18:14:49
Problema Triang Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 1 kb
// 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 = 0; i < n; i++)
	{
		for (j = i + 1; 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;
}