2011年3月23日

poj 3422

摘要: 费用流,数据很水。代码:#include<iostream>#include<fstream>using namespace std;#define oo 10000000typedef struct e{ int data; e *next,*opt; int c,cost; }e;e edge[5003];int n,m;int v[5003],d[5003];int path[5003];e *path1[5003];int spfa(){ int queue[5005],i,j,k; memset(v,0,sizeof(v)); for(i=0;i<=n* 阅读全文

posted @ 2011-03-23 18:52 宇宙吾心 阅读(457) 评论(0) 推荐(0)

poj 2409

摘要: 分两种情况讨论:旋转:n种旋转方法每种旋转i个格(1<=i<=n)循环结有gcd(i,n)个翻转:(1)这种是经过某个顶点i与中心的连线为轴的翻转,由于n为偶数,有对称性,所以此种共n/2种翻转:(2)这种是以顶点i和i+1的连线的中点与中心的连线为轴的翻转,同样,根据对称性,也有n/2种翻转:所以给定长度n,共有2n种置换。代码:#include<iostream>#include<fstream>#include<cmath>using namespace std;int gcd(int s,int t){ if(t==0) return s 阅读全文

posted @ 2011-03-23 16:57 宇宙吾心 阅读(582) 评论(0) 推荐(0)

导航