摘要: 趁热打铁,再做了道欧拉回路,形成欧拉回路的条件1、所有节点的度都是偶数2、所有节点连通#include <iostream>#include <cstring>using namespace std;#ifndef ONLINE_JUDGE#include <fstream>ifstream fin("test.txt");#define cin fin#endifint degree[1010],p[1010];int find(int x){ return x == p[x] ? x : p[x] = find(p[x]);}int 阅读全文
posted @ 2013-05-22 22:03 see_why 阅读(158) 评论(0) 推荐(0)
摘要: 第一次接触欧拉路,看了大神的解题报告后写出并查集+欧拉回路,先要用并查集判断是否连通,然后再根据每个节点的入度与出度判断是否为欧拉回路或欧拉路如果所有点入度等于出度,则为欧拉回路如果起点的入度比出度小一且终点的入度比出度大一,则为欧拉路#include <iostream>#include <cstring>using namespace std;#ifndef ONLINE_JUDGE#include <fstream>ifstream fin("test.txt");#define cin fin#endifint p[27],vis 阅读全文
posted @ 2013-05-22 20:48 see_why 阅读(127) 评论(0) 推荐(0)
摘要: [cce_cpp]//网络流,基本是照着书上的代码敲的,还敲错了o(╯□╰)o#include <cstdio>#include <algorithm>#include <queue>#include <cstring>using namespace std;int cap[20][20],flow[20][20],a[20],p[20];const int INF = 1000000;int main(){ int t,n,m,x,y,c,f; scanf("%d",&t); for(int i = 1; i < 阅读全文
posted @ 2013-05-22 14:50 see_why 阅读(173) 评论(0) 推荐(0)