poj 1118 Lining Up(水题)
再思考一下好的方法,水过,数据太弱! 本来不想传的!
#include <iostream>
using namespace std;
#define MAX 702
/*284K 422MS*/
typedef struct _point
{
int x;
int y;
}point; point p[MAX]; bool judge(point a,point b,point c)
{
return (a.y-b.y)*(c.x-b.x)-(c.y-b.y)*(a.x-b.x);
} int main()
{
int n;
while(cin>>n)
{
if(n==0) break;
for(int i=0;i<n;i++)
cin>>p[i].x>>p[i].y;
int max=0;
//暴力搜索
for(int k=0;k<n;k++)
{
for(int i=k+1;i<n;i++)
{
int sum=0;
for(int j=i+1;j<n;j++)
{
if(!judge(p[k],p[i],p[j]))
++sum;
}
if(max<sum)
max=sum;
}
} cout<<max+2<<endl;
}
system("pause");
return 0;
}
poj 1118 Lining Up(水题)的更多相关文章
- POJ 1488 Tex Quotes --- 水题
POJ 1488 题目大意:给定一篇文章,将它的左引号转成 ``(1的左边),右引号转成 ''(两个 ' ) 解题思路:水题,设置一个bool变量标记是左引号还是右引号即可 /* POJ 1488 T ...
- POJ 3641 Oulipo KMP 水题
http://poj.org/problem?id=3461 直接KMP就好.水题 #include<cstdio> #include<cstring> const int M ...
- poj 1006:Biorhythms(水题,经典题,中国剩余定理)
Biorhythms Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 110991 Accepted: 34541 Des ...
- poj 1002:487-3279(水题,提高题 / hash)
487-3279 Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 236746 Accepted: 41288 Descr ...
- poj 1003:Hangover(水题,数学模拟)
Hangover Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 99450 Accepted: 48213 Descri ...
- poj 2105 IP Address(水题)
一.Description Suppose you are reading byte streams from any device, representing IP addresses. Your ...
- poj 2000 Gold Coins(水题)
一.Description The king pays his loyal knight in gold coins. On the first day of his service, the kni ...
- POJ 1118 Lining Up 直线穿过最多的点数
http://poj.org/problem?id=1118 直接枚举O(n^3) 1500ms能过...数据太水了...这个代码就不贴了... 斜率排序O(n^2logn)是更好的做法...枚举斜率 ...
- POJ 3673 Cow Multiplication (水题)
题意:给你两个数,求所有的数位的积的和. 析:太水了,没的说,可以先输入边算,也可以最后再算,一样.. 代码如下: #include <cstdio> #include <strin ...
随机推荐
- avd name对AVD的创建的影响
创建avd的时候出现OK按钮显示灰色不可按状态,各种系数都显示对的.如下所示: 检查了各项觉得没有什么错,最后原来出错在AVD的name上面,不允许有空格或者非英文字母,把空格取消之后就没有问题了.
- 将数组适配到ListView
public class TutListActivity extends ListActivity { @Override public void onCreate(Bundle savedInsta ...
- mvc of js
http://alexatnet.com/articles/model-view-controller-mvc-javascript The article demonstrates how to a ...
- javascript链式调用实现方式总结
方法链一般适合对一个对象进行连续操作(集中在一句代码).一定程度上可以减少代码量,缺点是它占用了函数的返回值. 一.方法体内返回对象实例自身(this) function ClassA(){ this ...
- Java实现二叉搜索树的添加,前序、后序、中序及层序遍历,求树的节点数,求树的最大值、最小值,查找等操作
什么也不说了,直接上代码. 首先是节点类,大家都懂得 /** * 二叉树的节点类 * * @author HeYufan * * @param <T> */ class Node<T ...
- raft 一致性算法
介绍: 过去, Paxos一直是分布式协议的标准,但是Paxos难于理解,更难以实现,Google的分布式锁系统Chubby作为Paxos实现曾经遭遇到很多坑. 来自Stanford的新的分布式协议研 ...
- 新浪系统工程师笔试--shell
1. test01 test02 1 200 1 100 2 500 2 300 3 200 3 50 4 100 4 150 输出 200 100 100 500 300 ...
- 全国计算机等级考试二级教程-C语言程序设计_第5章_循环结构
for循环结构的嵌套 外层循环每循环一次,内层循环会完整循环一次. 外层循环是竖. 内层循环是横. for, do...while, while的选择: 如果有固定次数,如阶乘! ,判断素数,用 fo ...
- SQLite.dll混合模式程序集是针对“v2.0.50727”版的运行时生成的,在没有配置其他信息的情况下,无法在 4.0 运行时中加载该程序集。
其他信息: V5.7.4.4 Can't find the System.Data.SQLite.dll more info : 混合模式程序集是针对"v2.0.50727"版的运 ...
- Ajax请求ashx返回各类数据的常见处理方式
.请求text数据,在success事件中手动解析 前台: $.ajax({ type: "post", url: "checkFile.ashx", data ...