Boundary

给定平面上2000个以内的不同点,不包括原点(0,0),找到所有以原点为边界的圆中,包含点数最多的那个圆,输出其边界上的点数。通过分析,可以推导出三点确定一个圆,并使用中垂线交点求圆心,然后通过枚举和统计圆心来解决问题。" 136754187,1328852,2024年3月16日Rust热门开源项目精选,"['Rust', '开源项目', 'GitHub趋势', '远程桌面软件', '区块链技术']
摘要由CSDN通过智能技术生成

题目描述

Given {n}n points in 2D plane. Considering all circles that the origin point {(0, 0)}(0,0) is on their boundries, find the one with the maximum given points on its boundry. Print the maximum number of points.

输入

The first line contains one integer n~(1 \leq n \leq 2000)n (1≤n≤2000), denoting the number of given points.
Following {n}n lines each contains two integers x, y~(|x|,|y| \leq 10000)x,y (∣x∣,∣y∣≤10000), denoting a given point {(x, y)}(x,y).
It’s guaranteed that the points are pairwise different and no given point is the origin point.

输出

Only one line containing one integer, denoting the answer.

样例输入

4
1 1
0 2
2 0
2 2

样例输出

3

题目大意

给定平面上n个点,考虑所有原点(0,0)在边界上的圆,找出最多有几个点可以在同一个圆的边界上。输出数量。

分析

乍一看挺难,其实可以推公式。
用我们小学二年级学过的知识就知道三点确定一个圆,求出任意两条两点连线段的中垂线,求出交点坐标即可(方法很多,不一一列举了)。
说完推导过程,上公式:

已知圆上三点为(x1,y1),(x2,y2),(x3,y3),设圆心坐标为(x,y),:
x=((y2-y1)*(y3*y3-y1*y1+x3*x3-x1*x1)-(y3-y1)*(y2*y2-y1*y1+x2*x2-x1*x1))/(2.0
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值