![](https://img-blog.csdnimg.cn/20201014180756926.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
无归类的算法
xiaofengsheng
这个作者很懒,什么都没留下…
展开
-
pku 2153 Rank List
#include #include #define SAFEDELETE_ARRAY(p) / { if(p) {delete []p; p=NULL; } }using namespace std;//------------- typedef struct student{ int score; char name[32原创 2008-12-07 17:51:00 · 567 阅读 · 0 评论 -
pku 2051 Argus
#include #include using namespace std;//----------- typedef struct rf{ int ID; int time; int interval;}refer;int SearhMinTime(refer *r,int count){ int minTime原创 2008-12-08 23:14:00 · 540 阅读 · 0 评论 -
pku 2159 水题,题意有些难懂,特意贴出来,以候来者
#include #include #include using namespace std;int hash1[26];int hash2[26];int main(){ string s1, s2; cin >> s1 >> s2; for(unsigned int i = 0; i < s1.size(); ++i) hash1[s1[i]-A原创 2009-03-17 18:55:00 · 633 阅读 · 0 评论 -
pku 1083 水题
#include using namespace std;int hash[205];int main(){ int T, N; int s, t; scanf("%d", &T); while(T--) { memset(hash, 0, sizeof(int)*205); scanf("%d", &N); while(N--) {原创 2009-03-17 19:50:00 · 1011 阅读 · 0 评论 -
一个google笔试题(暂存)
问题:写一个算法,求一个有n个节点的二叉树中有m个节点的连通图的个数,分析算法复杂度。(解法待续)原创 2009-04-20 10:10:00 · 726 阅读 · 0 评论 -
标程: qsort
QUICKSORT(A, p, r )if p then q ←PARTITION(A, p, r ) QUICKSORT(A, p, q − 1) QUICKSORT(A, q + 1, r ) Initial call is QUICKSORT(A, 1, n).PartitioningPartition subarray A[p原创 2009-05-05 22:42:00 · 429 阅读 · 0 评论 -
pku 1273 Drainage Ditches 最大流入门基础题
#include #include #include #include using namespace std;#define MAX_VALUE 0x7fffffffint map[201][201];int path[201]; //path[i]: 路径, 保存i点的前一节点path[i]int flow[201]; //flow[i]: 保存此节点的最大原创 2009-12-30 21:47:00 · 625 阅读 · 0 评论 -
pku 2001 Shortest Prefixes 排序
这题我的做法是排序后, 对前一字符串和后一字符串推断出该字符串的最短前缀.做完看discuss中, 有人说可以用字典树, 我还没用过, 有时间时打算看一下. #include #include #include #include using namespace std;#define MAX(a,b) ((a>b)?(a):(b))struct Node原创 2010-03-30 12:52:00 · 542 阅读 · 0 评论