比赛 Asm_Def战记之透明计算网络 评测结果 EEEEEEEEEE
题目名称 Asm_Def的模拟赛 最终得分 0
用户昵称 VG|Kn. 运行时间 0.761 s
代码语言 C++ 内存使用 0.32 MiB
提交时间 2015-11-01 11:01:47
显示代码纯文本
#include<iostream>
#include<cmath>
#include<cstdlib>
#include<cstdio>
using namespace std;

const int maxn = 300 + 5;
int n;
int cntd, cntf = 1;
int maxd = 0;

struct zb
{
	int x;
	int y;
}d[maxn]; 

int pdtc(
    int x,
    int y,
    int xx,
    int yy,
    int x1,
    int y1,
    int x2,
    int y2
    ) 
{
	int k = (y2 - y1) / (x2 - x1);
	int b = y1 - k * x1; 
	if ((k * x + b < y) && (k * xx + b < yy))
		return 1;
	if ((k * x + b > y) && (k * xx + b > yy))
		return 1;
	if ((k * x + b < y) && (k * xx + b > yy))
		return 0;
	if ((k * x + b > y) && (k * xx + b < yy))
		return 0;
}

int pdnb(int xx, int yy, int x1, int y1, int x2, int y2, int x3, int y3)
{
	if (pdtc(xx,yy,x1,y1,x2,y2,x3,y3) == 1 && pdtc(xx,yy,x2,y2,x1,y1,x3,y3) == 1 && pdtc(xx,yy,x3,y3,x2,y2,x1,y1) == 1)
		return 1;
	else
		return 0;
}

int main()
{
	freopen("trib.in","r",stdin);
	freopen("trib.out","w",stdout);
	cin >> n;
	for (int i = 1; i <= n; i++)
	{
		cin >> d[i].x >> d[i].y;
	}
	for (int i = 1; i <= n-2; i++)
	{
		for (int j = i; j <= n-1; j++)
		{
			for (int k = j; k <= n; k++)
			{
				cntd = 0;
				for (int l = 1; l <= n; l++)
				{
					if (pdnb(d[l].x,d[l].y,d[i].x,d[i].y,d[j].x,d[j].y,d[k].x,d[k].y) == 1)
						cntd++;
				}
				if (cntd > maxd)
					maxd = cntd;
				if (cntd == maxd)
					cntf++;
			}
		}
	}
	cout << maxd << endl;
	cout << cntf;
	return 0;
}