Shirlies
宁静专注认真的程序媛~
posts - 222,comments - 49,views - 71万
09 2012 档案
hdu 1509【Windows Message Queue】
摘要:直接暴力,虽然效率很差。。。。。。View Code 1 #include <iostream> 2 #include <queue> 3 using namespace std; 4 5 struct node 6 { 7 char name[100]; 8 int para; 9 int prio;10 int id;11 friend bool operator < (const node& a,const node& b)12 {13 if(a.prio == b.prio)14 return ... 阅读全文
posted @ 2012-09-22 21:03 Shirlies 阅读(192) 评论(0) 推荐(0) 编辑
hdu 1873【看病要排队】
摘要:直接模拟。。。View Code 1 #include <iostream> 2 #include <cstring> 3 #include <queue> 4 using namespace std; 5 6 typedef pair<int,int> pii; 7 8 struct node 9 {10 int id,kb;11 node(){}12 node(int a,int b)13 {14 id = b;15 kb = a;16 }17 friend bool operator <(const n... 阅读全文
posted @ 2012-09-21 23:08 Shirlies 阅读(251) 评论(0) 推荐(0) 编辑
hdu 1237【简单计算器】
摘要:简单题,直接模拟,但是还是要仔细点。。。View Code 1 #include <iostream> 2 #include <stack> 3 #include <iomanip> 4 #include <ios> 5 using namespace std; 6 7 int main() 8 { 9 double a;10 while(cin >> a)11 {12 stack<double> Snum;13 stack<char> Sop;14 15 Snum.push(a);16 char ch... 阅读全文
posted @ 2012-09-21 22:32 Shirlies 阅读(294) 评论(0) 推荐(0) 编辑
poj 3352【Road Construction】
摘要:狂晕,是我做题太少了吧?我竟然直接按输入输出的模式做题,即输出“Output for Sample Input 1”,呜呜,WA了几次就是因为这个。。。。。。。。。。。。。。。。。。。。。。。。。。。View Code 1 #include <iostream> 2 #include <vector> 3 #include <cstring> 4 #include <algorithm> 5 using namespace std; 6 7 const int maxN = 1000+10; 8 int low[maxN]; 9 int DFN[ 阅读全文
posted @ 2012-09-14 20:51 Shirlies 阅读(220) 评论(0) 推荐(0) 编辑
poj 3177【Redundant Paths】
摘要:将图变成双连通图,缩点,考虑该点与其他点相连的个数,如果只有一条边与其他点相连,则需要加一条边,因为这里面的点只能通过一条边到其他点,加一条边让它们能够通过另一条边到达其他点。View Code 1 #include <iostream> 2 #include <cstring> 3 #include <vector> 4 using namespace std; 5 6 const int maxN = 5000+10; 7 int low[maxN]; 8 int DFN[maxN]; 9 int degree[maxN];10 int cnt;11 1 阅读全文
posted @ 2012-09-13 21:19 Shirlies 阅读(161) 评论(0) 推荐(0) 编辑
poj 2762【Going from u to v or from v to u?】
摘要:先用Tarjan求出强连通分量,其他算法也可以的,再缩点,然后从入度为0的点开始暴搜,如果深度达到强连通分量的个数即可行。这一题一定要注意一点:我用cin的时候TLE,该scanf就好了。。。View Code 1 #include <cstdio> 2 #include <cstring> 3 #include <vector> 4 using namespace std; 5 6 const int maxN = 1000 + 10; 7 vector<int> edge[maxN]; 8 int low[maxN]; 9 int stack 阅读全文
posted @ 2012-09-09 21:05 Shirlies 阅读(166) 评论(0) 推荐(0) 编辑
poj 2186【Popular Cows】1236【Network of Schools】2553【The Bottom of a Graph】
摘要:三种方法求极大强连通分支的算法,一题一种方法poj 2186 求牛被所有其它的牛崇拜的个数,在一个强连通分量里面的牛是互相崇拜的,所以如果这个强连通分支被其它牛崇拜那么这里面的牛都被其它牛崇拜.。。。这一题我用的Tarjan算法View Code 1 #include <iostream> 2 #include <cstring> 3 #include <vector> 4 using namespace std; 5 6 const int maxN = 10000+10; 7 int low[maxN]; 8 int stack[maxN],top; 9 阅读全文
posted @ 2012-09-08 22:14 Shirlies 阅读(254) 评论(0) 推荐(0) 编辑
poj 1659【Frogs' Neighborhood】
摘要:Havel-Hakimi定理http://blog.sina.com.cn/s/blog_818d3d930100wdv1.htmlhttp://hi.baidu.com/krdefndrsbbekmd/item/a7c58810f40156f8dceecab7View Code 1 #include <iostream> 2 #include <cstring> 3 #include <algorithm> 4 using namespace std; 5 6 struct node 7 { 8 int u; 9 int dg;10 }p[15];11 i 阅读全文
posted @ 2012-09-05 09:43 Shirlies 阅读(229) 评论(0) 推荐(0) 编辑
poj 3522【Slim Span】
摘要:题意:给你一个无向图,没有重边,没有自环,要你求该图中一颗生成树,但是这个生成树的最大边与最小边的差值要最小。如果固定一个最小边,求得最小生成树后,最大边也就知道了,其实这个也意味着在固定最小边的情况下最小生成树的最大边是固定的,可是为什么我们一定要求最小生成树呢,因为其他的生成树的最大边与最小边的差值要大于等于最小生成树的大小边之差,这个的原因大家可以自己仔细想想最小生成树的性质和次小生成树的求法(枚举每条最小生成树上的边,不要此条边求得的生成树,选最小一个就是了,这个就意味着次小生成树里面肯定有一条边要比最小生成树的大,其它的相同)。这样说来的话,我们只需将边排好序后,枚举每条边,并用Kr 阅读全文
posted @ 2012-09-02 12:29 Shirlies 阅读(208) 评论(0) 推荐(0) 编辑

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

点击右上角即可分享
微信分享提示