大意:是否存在一条直线,使所有线段在直线上的投影至少交与一点
思路:转换为是否存在一条直线与所有的线段相交,做这条直线的垂线,那么垂线即为所求 3 **/ 4 #include 5 #include 6 using
namespace std; 7 int n; 8 const double...
分类:
其他好文 时间:
2014-05-13 19:55:23
阅读次数:
234
1 /** 2 给定一定范围求其内的素数 3 4 注意: 5 **/ 6 7 #include 8
#include 9 #include 10 using namespace std;11 #define maxn 100000012 long long
prime[500000];1...
分类:
其他好文 时间:
2014-05-13 19:50:13
阅读次数:
242
1 /** 2 注意: 千万得小心。。就因为一个分号,调了一个晚上。。。 3 **/ 4
#include 5 #include 6 using namespace std; 7 struct point { 8 int x,y; 9 }; 10
11 struct...
分类:
其他好文 时间:
2014-05-13 19:43:02
阅读次数:
275
1 Accepted 8508K 391MS C++ 2004B 2
相比下边,,优化太多太多了。。。 3 /** 4 baby-step-giant-step 因为数据量太大,,自己写hash 5 6 **/ 7
#include 8 #include...
分类:
其他好文 时间:
2014-05-13 19:27:32
阅读次数:
363
Cut the Sequence
Time Limit: 2000MS
Memory Limit: 131072K
Total Submissions: 8764
Accepted: 2576
Description
Given an integer sequence { an } of length N, you are to ...
分类:
其他好文 时间:
2014-05-13 16:04:29
阅读次数:
267
Sliding Window
Time Limit: 12000MS
Memory Limit: 65536K
Total Submissions: 36469
Accepted: 10803
Case Time Limit: 5000MS
Description
An array of size n ≤ 106 is gi...
分类:
其他好文 时间:
2014-05-13 15:36:47
阅读次数:
357
Description
Japan plans to welcome the ACM ICPC World Finals and a lot of roads must be built for the venue. Japan is tall island with N cities on the East coast and M cities on the West coast (M <= ...
分类:
其他好文 时间:
2014-05-13 14:53:40
阅读次数:
189
大意:给出数组a,内容为 a1 a2 a3 ... an。再给一个常数k。从i=1起,计算ai、a i+1、...、a i+k-1区间内的最小值和最大值。
线段树咯。...
分类:
其他好文 时间:
2014-05-13 14:11:41
阅读次数:
187
本文为senlie原创,转载请保留此地址:http://blog.csdn.net/zhengsenlie
Best Time to Buy and Sell Stock II
Total Accepted: 13030 Total
Submissions: 36467
Say you have an array for which the ith ...
分类:
其他好文 时间:
2014-05-13 14:08:39
阅读次数:
414
思路:半夜了思路有点混乱wa了好几发。一开始坑定两个人距离为m才能获得最大的收益,所以我们就可以枚举单个端点,当距离达到m时在一同一个方向走这是我们只需要算一下剩下几秒,左右两边贪心去最大的即可。代码如下:
1 /*******************************************...
分类:
其他好文 时间:
2014-05-13 09:58:02
阅读次数:
268