luogu2665&bzoj1610 [USACO08FEB]连线游戏Game of Lines

网友投稿 683 2022-08-29

luogu2665&bzoj1610 [USACO08FEB]连线游戏Game of Lines

luogu2665&bzoj1610 [USACO08FEB]连线游戏Game of Lines

​​ 题目背景

Farmer John最近发明了一个游戏,来考验自命不凡的贝茜。

题目描述

Farmer John has challenged Bessie to the following game: FJ has a board with dots marked at N (2 ≤ N ≤ 200) distinct lattice points. Dot i has the integer coordinates Xi and Yi (-1,000 ≤ Xi ≤ 1,000; -1,000 ≤ Yi ≤ 1,000).

Bessie can score a point in the game by picking two of the dots and drawing a straight line between them; however, she is not allowed to draw a line if she has already drawn another line that is parallel to that line. Bessie would like to know her chances of winning, so she has asked you to help find the maximum score she can obtain.

游戏开始的时 候,FJ会给贝茜一块画着N (2 <= N <= 200)个不重合的点的木板,其中第i个点 的横、纵坐标分别为X_i和Y_i (-1,000 <= X_i <=1,000; -1,000 <= Y_i <= 1,000)。 贝茜可以选两个点画一条过它们的直线,当且仅当平面上不存在与画出直线 平行的直线。游戏结束时贝茜的得分,就是她画出的直线的总条数。为了在游戏 中胜出,贝茜找到了你,希望你帮她计算一下最大可能得分。

输入输出格式

输入格式:

第1行: 输入1个正整数:N

第2..N+1行: 第i+1行用2个用空格隔开的整数X_i、Y_i,描述了点i的坐标

输出格式:

第1行: 输出1个整数,表示贝茜的最大得分,即她能画出的互不平行的线段数

输入输出样例

输入样例#1:

4 -1 1 -2 0 0 0 1 1 输出样例#1:

4 说明

贝茜能画出以下4种斜率的直线:-1,0,1/3以及1。

USACO2008 Feb T1

求一下有多少种不同的斜率x

#include#include#define N 220#define pa pairusing namespace std;inline int read(){ int x=0,f=1;char ch=getchar(); while (ch<'0'||ch>'9') {if (ch=='-') f=-1;ch=getchar();} while (ch<='9'&&ch>='0'){x=x*10+ch-'0';ch=getchar();} return x*f;}pa ans[N*N];int x[N],y[N],n;int gcd(int x,int y){ if (y==0) return x; return gcd(y,x%y);}inline bool cmp(pa a,pa b){ return a.first==b.first?a.second

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:bzoj1986 [USACO2004 Dec] Dividing the Path 划区灌溉
下一篇:在kubernetes集群中部署php应用(Kubernetes部署)
相关文章

 发表评论

暂时没有评论,来抢沙发吧~