#include<iostream>
#include<set>
#include<stdio.h>
#include<math.h>
#include<algorithm>
#define MAXN 705
using namespace std; int num;
double p[MAXN][];
double a[MAXN*MAXN];
set<int> coll;
set<int>::iterator pos;
multiset<int> coll_main;
int main()
{
//freopen("acm.acm","r",stdin);
int i;
int max;
int j;
int k;
int t;
double value;
int num;
double s2;
while()
{
scanf("%d",&num);
if(num == )
break;
max = ; for(i = ; i < num; ++ i)
{
scanf("%lf%lf",&p[i][],&p[i][]);
}
for(i = ; i < num; ++ i)
{
k = ;
for(j = ; j < num; ++ j)
{
if(i != j)
{
value = (p[i][] - p[j][]) / (p[i][] - p[j][]);
a[k] = value;
++ k;
}
}
//////////////////////////////////////
sort(a,a + k);
s2 = a[];
j = ; for(t = ; t < k; ++ t)
{
if(a[t] == s2)
++ j;
else
{
if(j > max)
{
max = j;
}
s2 = a[t];
-- t;
j = ;
}
}
if(j > max)
max = j;
// cout<<max<<endl; //while(1)
//{
// if(i*(i-1) == 2*max)
// {
// cout<<i<<endl;
// break;
// }
// ++ i;
//}
}
++max;
// cout<<max<<"======="<<endl;
//cout<<int((1+(int)(sqrt(long double(1+8*max))+0.5))/2.0)<<endl;
cout<<max<<endl;
}
}

关注我的公众号,当然,如果你对Java, Scala, Python等技术经验,以及编程日记,感兴趣的话。

技术网站地址: vmfor.com

POJ 1118的更多相关文章

  1. HDU 1432 Lining Up (POJ 1118)

    枚举,枚举点 复杂度为n^3. 还能够枚举边的,n*n*log(n). POJ 1118 要推断0退出. #include<cstdio> #include<cstring> ...

  2. 【同一直线最多点】 poj 1118+2606+2780

    poj 1118 #include<iostream> using namespace std; #define N 700 struct point {int x,y;} pnt[N]; ...

  3. POJ 1118 Lining Up 直线穿过最多的点数

    http://poj.org/problem?id=1118 直接枚举O(n^3) 1500ms能过...数据太水了...这个代码就不贴了... 斜率排序O(n^2logn)是更好的做法...枚举斜率 ...

  4. poj 1118 Lining Up(水题)

    再思考一下好的方法,水过,数据太弱! 本来不想传的! #include <iostream> using namespace std; #define MAX 702 /*284K 422 ...

  5. POJ 1118 Lining Up

    枚举,排序. 先将所有点按双关键字排序,然后枚举线的顶点$P$,剩余的点以$P$为中心进行极角排序,可以取个$gcd$,这样一样的点就排在一起了,然后统计一下更新答案. #pragma comment ...

  6. UVa 270 & POJ 1118 - Lining Up

    题目大意:给一些点,找出一条直线使尽可能多的点在这条直线上,求这条直线上点的个数. 以每一个点为原点进行枚举,求其它点的斜率,斜率相同则说明在一条直线上.对斜率排序,找出斜率连续相等的最大长度. #i ...

  7. POJ 1118 求平面上最多x点共线

    题意:给你n个点的坐标.求一条直线最多能穿过多少个点. 思路:枚举(n^2)+求斜率+排序 (复杂度n^2logn)大功告成 //By: Sirius_Ren #include <cmath&g ...

  8. POJ 题目分类(转载)

    Log 2016-3-21 网上找的POJ分类,来源已经不清楚了.百度能百度到一大把.贴一份在博客上,鞭策自己刷题,不能偷懒!! 初期: 一.基本算法: (1)枚举. (poj1753,poj2965 ...

  9. (转)POJ题目分类

    初期:一.基本算法:     (1)枚举. (poj1753,poj2965)     (2)贪心(poj1328,poj2109,poj2586)     (3)递归和分治法.     (4)递推. ...

随机推荐

  1. hdu-1711(kmp算法)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1711 思路:kmp模板,注意用scanf,不然超时. #include<iostream> ...

  2. Android 长时间运行任务说明

    android 4.0 后,小米手机需要授权 自动启动 (在安全中心权限里设置),不然AlarmManager设置系统闹钟将不起作用

  3. 山东省第七届ACM竞赛 J题 Execution of Paladin (题意啊)

    题意:鱼人是炉石里的一支强大种族,在探险者协会里,圣骑士有了一张新牌,叫亡者归来,效果是召唤本轮游戏中7个已死鱼人.如果死掉的不足7个,那么召唤的数量就会不足7. 鱼人有很多,下面的4个是: 寒光智者 ...

  4. 代码自动生成工具MyGeneration之一

    前段时间用C#做网站,用到了大量数据库相关的东西.网站采用3层结构,即数据访问层(Data Access Layer),业务逻辑层(Business Logic Layer),页面表现层().做了一段 ...

  5. (字典树)How many--hdu--2609

    http://acm.hdu.edu.cn/showproblem.php?pid=2609 How many Time Limit: 2000/1000 MS (Java/Others)    Me ...

  6. (并查集 建立关系)Parity game -- POJ -1733

    链接: http://poj.org/problem?id=1733 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=82830#probl ...

  7. (最小生成树 次小生成树)The Unique MST -- POJ -- 1679

    链接: http://poj.org/problem?id=1679 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=82831#probl ...

  8. Codeforces777E. Hanoi Factory 2017-05-04 18:10 42人阅读 评论(0) 收藏

    E. Hanoi Factory time limit per test 1 second memory limit per test 256 megabytes input standard inp ...

  9. hdu 2048 神上帝以及老天爷

    题目 解题思路:      典型的错排题目      首先求出所有的拿错的情况,然后求出错排的所有情况,以前者除以后者就是百分比      现在求对应的所有都拿错的情况.容易知道,f(1)=0,f(2 ...

  10. SPFA穿越虫洞——负权回路得判断

    poj3259 题目大意:穿越虫洞可以回到过去(时间--)所以能不能让时间倒流呢,就是判断有没有负权回路这次尝试用SPFA算法,也可以复习一下链式前向星 准备工作,队列q,spfa算法得有点就在于这个 ...