摘要: 题目中文的,不解释了维护一个最大值的线段树 1 #include <stdio.h> 2 3 #define lson l, m, rt<<1 4 #define rson m+1, r, rt<<1|1 5 6 const int maxn = 200000; 7 8 char cmd[2]; 9 int n, mNum, a, b, max[maxn<<2];10 11 int Max(int x, int y)12 {13 return (x>y ? x:y);14 }/* Max */15 16 void BuildTree(int 阅读全文
posted @ 2012-05-03 15:33 Maxwell:My Blog 阅读(310) 评论(0) 推荐(0) 编辑
摘要: 题目大意:FJ需要修补牧场的围栏,他需要 N 块长度为 Li 的木头(N planks of woods)。开始时,FJ只有一块无限长的木板,因此他需要把无限长的木板锯成 N 块长度为 Li 的木板,Farmer Don提供FJ锯子,但必须要收费的,收费的标准是对应每次据出木块的长度,比如说测试数据中 5 8 8,一开始,FJ需要在无限长的木板上锯下长度 21 的木板(5+8+8=21),第二次锯下长度为 5 的木板,第三次锯下长度为 8 的木板,至此就可以将长度分别为 5 8 8 的木板找出题目可以转化为Huffman树构造问题 : 给定 N planks of woods,1. 在 N.. 阅读全文
posted @ 2012-04-29 10:52 Maxwell:My Blog 阅读(1477) 评论(0) 推荐(0) 编辑
摘要: 大数据量,海量数据 处理方法总结(转)转载请注明出处:http://duanple.blog.163.com/blog/static/7097176720091026458369/作者phylips@bmy参考文献:http://blog.csdn.net/jiaomeng/archive/2007/03/08/1523940.aspx d-Left Hashinghttp://blog.csdn.net/jiaomeng/archive/2007/01/27/1495500.aspxhttp://en.wikipedia.org/wiki/Bloom_filterhttp://hi.baid 阅读全文
posted @ 2012-04-22 15:48 Maxwell:My Blog 阅读(1809) 评论(3) 推荐(2) 编辑
摘要: 因为QM混乱的原因,白白WA了好几次AC 0MS 228K 1 #include <queue> 2 #include <stdio.h> 3 #include <stdlib.h> 4 #include <memory.h> 5 using namespace std; 6 7 const int maxn = 101; 8 const int INF = 0x3F3F3F3F; 9 10 int a, b, c, nNum, mNum;11 int g[maxn][maxn], QM[maxn], dist[maxn];12 13 int S 阅读全文
posted @ 2012-04-09 20:27 Maxwell:My Blog 阅读(1035) 评论(0) 推荐(2) 编辑
摘要: 经典BFS+记忆表解题思路:因为存在具有Hp为n的monster存在,如果直接压入队列,就有可能破坏广度优先树,因此必须在处理的过程中保证monster和‘.’的处理是保存同步的,处理方法:如果当前位置是monster,那么我就削减他一个HP,再压入队尾,直到HP为0时,把地图上monster的位置置为‘.’可行位置,这样一来,monster和‘.’的处理就同步了路径记录:运用到算法导论上的记忆化BFS,具体的操作是建立一个记忆表// 一次AC 0MS 444K 1 #include <queue> 2 #include <stdio.h> 3 #include < 阅读全文
posted @ 2012-03-24 19:55 Maxwell:My Blog 阅读(1167) 评论(0) 推荐(1) 编辑
摘要: 1 // Accept 31ms 544k 2 #include <math.h> 3 #include <stdio.h> 4 #include <stdlib.h> 5 #include <string.h> 6 #include <memory.h> 7 8 /* 将方程分划为2个部分,前一个部分最多有100*100种可能 */ 9 #define MAX 3009310 11 int s[10010]={0};12 int a, b, c, d, ans, temp, p, i, j;13 struct HashTable14 阅读全文
posted @ 2012-03-04 10:17 Maxwell:My Blog 阅读(1115) 评论(0) 推荐(1) 编辑