比赛 20161114 评测结果 WWWWWWWTTT
题目名称 输出全靠花 最终得分 0
用户昵称 BIRD 运行时间 3.016 s
代码语言 C++ 内存使用 0.34 MiB
提交时间 2016-11-14 11:50:16
显示代码纯文本
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>

struct Flower
{
	int x, y, z, w;
	double r;  //TIPS: 对于两个不同四维点(x1,y1,z1,w1),(x2,y2,z2,w2),可以确定一条直线,直线上的任意点(x,y,z,w),都存在唯一对应实数λ使得(x,y,z,w)=(x1+λ*(x2-x1),y1+λ*(y2-y1),z1+λ*(z2-z1),w1+λ*(w2-w1))
};
struct Flower flower[1005];
using namespace std;

bool check(int line1, int line2, int point){
	flower[point].r = (flower[point].x - flower[line1].x) / (flower[line2].x + flower[line1].x);
	double r2, r3, r4;
	r2 = (flower[point].y - flower[line1].y) / (flower[line2].y + flower[line1].y);
	r3 = (flower[point].z - flower[line1].z) / (flower[line2].z + flower[line1].z);
	r4 = (flower[point].w - flower[line1].w) / (flower[line2].w + flower[line1].w);
	if(flower[point].r == r2 && r2 == r3 && r3 == r4) return true;
	else return false;
}
int main()
{
	int n, ans = 0;
	freopen("xumingshi.in","r",stdin);
	freopen("xumingshi.out","w",stdout);
	scanf("%d", &n);
	for(int i = 1; i <= n; i++)
		scanf("%d%d%d%d", &flower[i].x, &flower[i].y, &flower[i].z, &flower[i].w);
	for(int i = 1; i <= n-2; i++)
		for(int j = i+1; j <= n-1; j++)
			for(int k = j+1; k <= n; k++)
				if(check(1,2,3)) ans++;
	printf("%d", ans);
	return 0;
}