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 ...
随机推荐
- 学习日记之模板方法模式和 Effective C++
模板方法模式: 定义:定义一个操作中的算法的骨架.而将一些步骤延伸到子类中.模板方法使得子类能够不改变算法的结构就可以重定义该算法的某些特定步骤. (1),用了继承,而且肯定这个继承有意义的情况下.就 ...
- c 判断水仙花数,质数(素数)
#include<stdio.h> #include<stdbool.h> //水仙花数--各位立方和等于本身 void sXh() { int x,y,z; printf(& ...
- 编写可维护的JavaScript—语句和表达式&变量、函数和运算符
语句和表达式 所有的块语句都应当使用花括号.包括: if for while do…while… try…catch…finally //不好的写法 if (condition) doSomethin ...
- Oracle递归sql笔记
查询一个机构下所辖机构: select * from t00_organ t start with t.organkey=#uporgankey# connect by prior t.organke ...
- 配置 .vimrc 解决 Vim / gVim 在中文 Windows 下的字符编码问题
转载自:-杨博的日志 - 网易博客 Vim / gVim 在中文 Windows 下的字符编码有两个问题: 默认没有编码检测功能 如果一个文件本身采用的字符集比 GBK 大(如 UTF-8.UTF-1 ...
- jQuery 子元素选择
对于如下代码片段 如何对河meishi这个div的子DIV呢? <div id="vertical-Menu-meishi" class="J-nav-item& ...
- 在Visual Studio 2010中安装iGraph
本安装步骤参考了:http://www.16kan.com/question/detail/182225.html Igraph actually does work with Visual C++ ...
- Code 49 码
Code 49码是一种多层.连续型.可变长度的条码符号,它可以表示全部的128个ASCII字符.每个Code 49条码符号由2到8层组成,每层有18个条和17个空.层与层之间由一个层分隔条分开.每层包 ...
- Hdu 3371 Connect the Cities(最小生成树)
地址:http://acm.hdu.edu.cn/showproblem.php?pid=3371 其实就是最小生成树,但是这其中有值得注意的地方:就是重边.题目没有告诉你两个城市之间只有一条路可走, ...
- C# Setup package Uninstaller
安裝的部分就不介紹了,網上一搜一大堆,這裡只介紹下卸載的部分. 1.在C:\Windows\System32 目录下找到 msiexec.exe 拷贝到相应的地方,可修改名称为 Uninstall.e ...