比赛 “Asm.Def战记之太平洋”杯 评测结果 TTTTTTTTTT
题目名称 Asm.Def的一秒 最终得分 0
用户昵称 VG|Kn. 运行时间 10.031 s
代码语言 C++ 内存使用 1.08 MiB
提交时间 2015-11-02 11:58:47
显示代码纯文本
#include<iostream>
#include<cstring>
#include<string>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
using namespace std;

const int maxn = 100000 + 100;
int n, a, b, c, d;
int cnt = 0;

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

node z;
double tl, ml = 10000000.0;
int tx, ty;
	
double js(node u, node v)
{
	double jl;
	jl = sqrt(pow(u.x-v.x,2) + pow(u.y-v.y,2));
	return jl;
}

void th()
{
	for (int i = 1; i <= n; i++)
	{
		if (zb[i].x > z.x && zb[i].y > z.y)
		{
			tl = js(zb[i], z);
			if (tl < ml)
			{
				tx = zb[i].x;
				ty = zb[i].y;
			}
		}
	}
	z.x = tx;
	z.y = ty;
}

int main()
{
	freopen("asm_second.in","r",stdin);
	freopen("asm_second.out","w",stdout);
	bool b;
	z.x = 0;
	z.y = 0;
	cin >> n;
	cin >> a >> b >> c >> d;
	for (int i = 1; i <= n; i++)
		cin >> zb[i].x >> zb[i].y;
	for (int i = 1; i <= n; i++)
	{
		if (zb[i].x > z.x && zb[i].y > z.y)
			b = true;
	}
	while (b)
	{
		th();
		cnt++;
	}
	cout << cnt;
	return 0;
}