![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
ACM
wegatron
这个作者很懒,什么都没留下…
展开
-
ZOJ Human or Pig
题目意思比较难懂,其实是是人的时候jump是可以控制的,而在为猪的时候jump是无法控制的。所以只要递推就可以了。题目有点坑,其实X*Y是可能超过40000的,所以还是定大点得数组。#include #include char g[500000];int m,n;int ind(int x,int y){ return x*(n+1)+y;}int main(){ i原创 2012-03-29 18:53:46 · 210 阅读 · 0 评论 -
ZOJ Unsafe Factor
这道题刚开始感觉是线段树问题,后然查了解题报告。发现方法很暴力,我还是有一些疑问,L的值10^7,n1和n2是10^5,为什么不会超时呢?解题报告上用了transform 和 find 两个SLT的函数,我把transform 换成了for循环后增加了10ms的时间,而把find函数换成for循环后直接TLE,网上查了说find的时间复杂度也是线性的,那为什么用find只要160ms,而用for循原创 2012-03-15 20:32:45 · 192 阅读 · 0 评论 -
线段树
线段树的存储结构:线段树的实现:typedef struct node{int ld,rd;struct node *lc, *rc;keytype key;} node;建空树:node* buildtree( int a, int b ){node* p = { 给p申请一块内存}p -> ld = a; p -> r原创 2013-03-21 21:16:50 · 1040 阅读 · 0 评论 -
求直线交点 叉积
一般方程法:直线的一般方程为F(x) = ax + by + c = 0。既然我们已经知道直线的两个点,假设为(x0,y0), (x1, y1),那么可以得到a = y0 – y1, b = x1 – x0, c = x0y1 – x1y0。因此我们可以将两条直线分别表示为F0(x) = a0*x + b0*y + c0 = 0, F1(x) = a1*x + b1*y +转载 2013-03-24 20:33:23 · 450 阅读 · 1 评论