题目描述:
Given n points
on a 2D plane, find the maximum number of points that lie on the same straight line.
解题思路:暴力求解。以每个点为中心,然后遍历剩余的点。对每个点,初始化一个map,以pair为key(dx,dy为两点之间x坐标与y坐标的差除以他们的最大公约数之后得到...
分类:
其他好文 时间:
2014-11-10 12:07:20
阅读次数:
152
Descriptionn participants of ?crazy tea party? sit around the table. Each minute one pair of neighbors can change their places. Find the minimum time ...
分类:
其他好文 时间:
2014-11-09 00:56:48
阅读次数:
241
根据Nginx(0.7.67版本)的代码,对Nginx基本的进程创建,进程主体以及事件处理进行了简要的分析。
基本上,父进程(即主进程)一开始会初始化及读取配置,并加载各模块的功能,然后fork()出N个子进程(即工作进程),具有相同的工作逻辑和功能。父进程负责监听信号(如HUP,QUIT等),通过socket pair把信号传递给子进程(子进程间一般不通信)。子进程通过事件来处理父进程...
分类:
系统相关 时间:
2014-11-08 20:55:14
阅读次数:
336
思路:
正难则反
//C(M+N,M)*C(Q+M-P,Q)-C(N+M-P,N)*C(M+Q,M);
代码:
#include"cstdlib"
#include"cstdio"
#include"cstring"
#include"cmath"
#include"stack"
#include"algorithm"
#include"iostream"
using namespace...
分类:
其他好文 时间:
2014-11-08 16:51:23
阅读次数:
164
题意:给定区间[l,r],l 2 #include 3 #include 4 #include 5 #include 6 #include 7 #define pb push_back 8 #define mp make_pair 9 #define esp 1e-810 #define...
分类:
其他好文 时间:
2014-11-07 14:36:50
阅读次数:
208
容器hash_set是以hash table为底层机制的,差点儿所有的操作都是转调用hash table提供的接口。因为插入无法存储同样的键值,所以hash_set的插入操作所有都使用hash table的insert_unique接口,代码例如以下:pair insert(const value_...
分类:
其他好文 时间:
2014-11-06 19:04:34
阅读次数:
200
1 #include 2 #include 3 #include 4 using namespace std; 5 6 typedef pair P; 7 8 char maze[41][41]; 9 int dist[41][41]; 10 int spDirX[4...
分类:
其他好文 时间:
2014-11-05 01:51:50
阅读次数:
203
socket是一种双向通信的起点和重点,氛围服务器端和客户端Socket服务器端用到的方法有MethodDescriptions.bind()This method binds address (hostname, port number pair) to socket.s.listen()This...
分类:
编程语言 时间:
2014-11-02 00:36:49
阅读次数:
145
bool compare(const pair &a,const pair&b)
{
return a.first v;
v.push_back(make_pair(4,2));
v.push_back(make_pair(2,4));
sort(v.begin(),v.end(),compare);...
分类:
编程语言 时间:
2014-11-01 14:54:47
阅读次数:
1098
基础的高斯消元解决异或方程问题。#include #include #include #include #include #include #include #include #include #include using namespace std; #define MP make_pair#de...
分类:
其他好文 时间:
2014-11-01 11:23:59
阅读次数:
156