CF 370
摘要:A:http://codeforces.com/problemset/problem/370/A 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 7 int main() 8 { 9 int chess[10][10];10 memset(chess,0,sizeof(chess));11 for(int i = 1; i 2 #include 3 int main() 4 { 5 int a[110][110]; 6 int cnt[110],x,n; 7 ...
阅读全文
posted @
2013-12-08 11:58
straw_berry
阅读(243)
推荐(0)
Drainage Ditches(Dinic最大流)
摘要:http://poj.org/problem?id=1273用Dinic求最大流的模板题,注意会有重边。邻接矩阵建图 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 const int maxn = 510; 7 const int INF = 0x3f3f3f3f; 8 int flow[maxn][maxn];//残量 9 int m,n;10 int dis[maxn];11 int bfs()//按层数“建”图,就是对每层的点用dis标记它到源点的层数12 {13 queueque;14 ...
阅读全文
posted @
2013-12-07 14:52
straw_berry
阅读(216)
推荐(0)
Super Phyllis(穷举+搜索)
摘要:http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2723题意:给出一些字符串u,v,代表u->v,问有几条边是多余的,也就是说去掉那些边后,u仍能到达v。思路:穷举每条边,试着去掉该边,bfs搜索两个点是否仍然可达。 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 using namespace std; 10 char s1[210],s2[210],..
阅读全文
posted @
2013-12-02 15:09
straw_berry
阅读(371)
推荐(0)
Rocky(dfs)
摘要:题目描述Sylvester Stallion is an old horse who likes nothing better than to wander around in the fields around his stable. Sylvester is a little single minded and will walk in a straight line unless there is a rock in this path. If that\'s the case, he does one of three things: 1) if there is no roc
阅读全文
posted @
2013-12-02 10:32
straw_berry
阅读(326)
推荐(0)