【练习记录】 202009-1 称检测点查询

【练习记录】 202009-1 称检测点查询,第1张

【练习记录】 202009-1 称检测查询
#include 
#include
#include
using namespace std;
int n, a, b, x, y, d;
vector> ds;
bool ju(vector a, vector b) {
	if (a[1] == b[1]) return a[0] < b[0];
	return a[1] < b[1];
}

int main() {
	int index = 1;
	while (cin >> n) {
		cin >> x >> y;
		while (n--) {
			cin >> a >> b;
			d = (x - a) * (x - a) + (y - b) * (y - b);
			vector t;
			t.push_back(index++);
			t.push_back(d);
			ds.push_back(t);
		}
		break;
	}
	sort(ds.begin(),ds.end(),ju);
	cout << ds[0][0] << endl << ds[1][0] << endl << ds[2][0];
	return 0;
}

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/5520723.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-13
下一篇 2022-12-13

发表评论

登录后才能评论

评论列表(0条)

保存