HDU 1432 Lining Up (POJ 1118)
枚举,枚举点 复杂度为n^3。
还能够枚举边的,n*n*log(n)。
POJ 1118 要推断0退出。
#include<cstdio>
#include<cstring>
#include<string>
#include<queue>
#include<algorithm>
#include<map>
#include<stack>
#include<iostream>
#include<list>
#include<set>
#include<vector>
#include<cmath> #define INF 0x7fffffff
#define eps 1e-8
#define LL long long
#define PI 3.141592654
#define CLR(a,b) memset(a,b,sizeof(a))
#define FOR(i,a,n) for(int i= a;i< n ;i++)
#define FOR0(i,a,b) for(int i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define ft first
#define sd second
#define sf scanf
#define pf printf
#define acfun std::ios::sync_with_stdio(false) #define SIZE 700+1
using namespace std; struct lx
{
int x,y;
}p[SIZE];
int n; int main()
{
while(~sf("%d",&n))
//while(~sf("%d",&n),n)
{
FOR(i,0,n)
sf("%d%d",&p[i].x,&p[i].y);
int ans=0;
int maxn=0;
FOR(i,0,n)
{
FOR(j,i+1,n)
{
maxn=0;
FOR(k,j+1,n)
{
if((p[j].x-p[i].x)*(p[k].y-p[j].y)==(p[j].y-p[i].y)*(p[k].x-p[j].x))
maxn++;
}
ans=max(maxn,ans);
}
}
pf("%d\n",ans+2);
}
}
HDU 1432 Lining Up (POJ 1118)的更多相关文章
- HDU 1432 Lining Up(几何)
http://acm.hdu.edu.cn/showproblem.php?pid=1432 题目大意: 2维平面上给定n个点,求一条直线能够穿过点数最多是多少. 解题思路: 因为题目给定的n(1~7 ...
- HDU 1535 Invitation Cards (POJ 1511)
两次SPFA. 求 来 和 回 的最短路之和. 用Dijkstra+邻接矩阵确实好写+方便交换.可是这个有1000000个点.矩阵开不了. d1[]为 1~N 的最短路. 将全部边的 邻点 交换. d ...
- HDU 1043 八数码(八境界)
看了这篇博客的讲解,挺不错的.http://www.cnblogs.com/goodness/archive/2010/05/04/1727141.html 判断无解的情况(写完七种境界才发现有直接判 ...
- hihoCoder 1432 : JiLi Number(吉利数)
hihoCoder #1432 : JiLi Number(吉利数) 时间限制:1000ms 单点时限:1000ms 内存限制:256MB Description - 题目描述 Driver Ji l ...
- HDU 5860 Death Sequence(死亡序列)
p.MsoNormal { margin: 0pt; margin-bottom: .0001pt; text-align: justify; font-family: Calibri; font-s ...
- HDU 5877 Weak Pair(弱点对)
HDU 5877 Weak Pair(弱点对) Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 262144/262144 K (Jav ...
- HDU 5813 Elegant Construction(优雅建造)
HDU 5813 Elegant Construction(优雅建造) Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/65 ...
- HDU 5818 Joint Stacks(联合栈)
HDU 5818 Joint Stacks(联合栈) Time Limit: 8000/4000 MS (Java/Others) Memory Limit: 65536/65536 K (Ja ...
- HDU 2222 Keywords Search(查询关键字)
HDU 2222 Keywords Search(查询关键字) Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K ...
随机推荐
- kinect for windows - DepthBasics-D2D详解之三
这篇文章我们将总结一下,之前两篇文章中提到的Kinect SDK的函数接. 函数接口: NuiGetSensorCount: 获取连接的Kinect设备个数 原型:_Check_return_ HRE ...
- Ubuntu系统下在Eclipse中使用真实手机运行调试Android应用
本文是在Ubuntu下已搭建好JRE+Eclipse+AndroidSDK的环境中进行的. 如果从未进行过如下的操作的话,在运行Android应用时,在设备选择器那里你的手机会显示为一大串" ...
- 【iOS知识学习】_UITableView简介
UITableView在iOS中估计是用的最多的控件了吧,几乎每个app都会用到. 一.它是一个非常重要的类来在table中展示数据. 1.是一个一维的表: 2.是UIScrollView的一个子类: ...
- 框架技术--Spring自动加载配置
今天项目中遇到一个问题,一个方法在服务启动后会自动被执行,查看了下配置未发现有定时的配置.但是后来发现是spring配置了启动时默认加载了方法. 代码: <?xml version=" ...
- [翻译]Orchard-修改首页布局
前言 Orchard在你的站点应用的默认主题叫做”Theme Machine”.该主题包括CSS样式和一个布局框架. Orchard 允许你选择或排除显示在你站点每个页面的布局. 默认情况下下图中蓝色 ...
- java之路径
在学习java的过程中经常遇见关于路径的问题:到底是使用绝对路径还是相对路径? 个人推荐使用相对路径,如果是使用绝对路径,到后期项目发布的时候会出现许多问题. 那么相对路径怎么用来: 一. Syste ...
- Python读取Excel数据并根据列名取值
一直想将自己接触到的东西梳理一遍,可就是迈不出第一步,希望从这篇总结开始不要再做行动的矮人了. 最近测试过程中需要用到python读取excel用例数据,于是去了解和学习了下xlrd库,这里只记录使用 ...
- Amazon Hiring Campus 2013 - Final 6
Let's assume that there is a simple market for beans. Every day there is a published bean price in t ...
- USB接口定义
一般的排列方式是:红白绿黑从左到右 定义: 红色-USB电源 标有-VCC.Power.5V.5VSB字样 绿色-USB数据线(正)-DATA+.USBD+.PD+.USBDT+ 白色-USB数据线( ...
- CloudStack 物理网络架构
原文地址:http://www.shapeblue.com/cloudstack/understanding-cloudstacks-physical-networking-architecture/ ...