08 2013 档案

摘要:题目链接:http://poj.org/problem?id=1011#include#include#include#includeusing namespace std;const int maxn = 100;int a[maxn];int N;int sum;int len,cnt;bool used[maxn];bool cmp(int a,int b){ return a > b;}bool dfs(int u,int curlen,int num){ if(num == cnt) return true; for(int i=u;i>N && N){ 阅读全文
posted @ 2013-08-31 14:51 等待最好的两个人 阅读(179) 评论(0) 推荐(0)
摘要:好苦逼,为啥数组开小了,不会runtime error,还得我WA了几个小时,我泪流满面。题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4620#include#include#include#include#includeusing namespace std;const int maxn = 35;struct Cut{ int T; int icnt; int bef_id; int a[11]; bool operator anspv){ anspv = deep; copy(t... 阅读全文
posted @ 2013-08-30 20:13 等待最好的两个人 阅读(196) 评论(0) 推荐(0)
摘要:题目链接:http://lightoj.com/volume_showproblem.php?problem=1031#include#include#include#includeusing namespace std;const int maxn = 105;int dp[maxn][maxn]; //dp[i][j] 表示先手从i到j比后手多的分差。int sum[maxn],a[maxn];int N;int main(){ // freopen("E:\\acm\\input.txt","r",stdin); int T; cin>> 阅读全文
posted @ 2013-08-28 20:03 等待最好的两个人 阅读(281) 评论(0) 推荐(0)
摘要:题目链接:http://lightoj.com/volume_showproblem.php?problem=1030#include#include#include#includeusing namespace std;const int maxn = 105;const int INF = 0x3f3f3f3f;double dp[maxn];int a[maxn];int main(){ //freopen("E:\\acm\\input.txt","r",stdin); int T; cin>>T; for(int cas=1;cas 阅读全文
posted @ 2013-08-28 18:56 等待最好的两个人 阅读(167) 评论(0) 推荐(0)
摘要:题目链接:http://lightoj.com/volume_showproblem.php?problem=1027#include#include#include#includeusing namespace std;int sum,ans,n,m;int Gcd(int a,int b){ if(a%b == 0) return b; return Gcd(b,a%b);}int main(){ //freopen("E:\\acm\\input.txt","r",stdin); int T; cin>>T; for(int cas=1 阅读全文
posted @ 2013-08-28 17:28 等待最好的两个人 阅读(170) 评论(0) 推荐(0)
摘要:题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3329参考网址:http://blog.csdn.net/morgan_xww/article/details/6775853#include#include#include#includeusing namespace std;const int maxn = 525;double A[maxn],B[maxn];int sta[maxn],icnt;int n,k1,k2,k3,a,b,c;int main(){ //freopen("E:\\ac 阅读全文
posted @ 2013-08-28 16:47 等待最好的两个人 阅读(165) 评论(0) 推荐(0)
摘要:题目链接:http://poj.org/problem?id=2096#include#include#include#includeusing namespace std;const int maxn = 1005;const int INF = 0x3f3f3f3f;double dp[maxn][maxn];int main(){ int n,s; cin>>n>>s; for(int i=n;i>=0;i--) for(int j=s;j>=0;j--) if(i == n && j == s) dp[n][s] = 0,dp[n+1 阅读全文
posted @ 2013-08-28 15:11 等待最好的两个人 阅读(161) 评论(0) 推荐(0)
摘要:题目链接:http://poj.org/problem?id=1080#include#include#include#includeusing namespace std;const int maxn = 105;const int INF = 0x3f3f3f;int dp[maxn][maxn];int A[maxn],B[maxn];int mymap[6][6] = { {0, 0, 0, 0, 0, 0}, {0,5,-1,-2,-1,-3 }, {0,-1,5,-3,-2,-4 ... 阅读全文
posted @ 2013-08-28 11:24 等待最好的两个人 阅读(135) 评论(0) 推荐(0)
摘要:题目链接:http://poj.org/problem?id=2479#include#include#include#includeusing namespace std;const int maxn = 50005;const int INF = 0x3f3f3f3f;int dp1[maxn];int dp2[maxn];int a[maxn];int N;int main(){ int T; cin>>T; while(T--){ scanf("%d",&N); for(int i=1;i=1;i--){ dp2[i]... 阅读全文
posted @ 2013-08-28 08:51 等待最好的两个人 阅读(147) 评论(0) 推荐(0)
摘要:题目链接:http://poj.org/problem?id=1192#include#include#include#include#includeusing namespace std;const int maxn = 1005;const int INF = 0x3f3f3f;int dp[maxn];vector G[maxn];int W[maxn];int N;struct Point{ int x,y;}P[maxn];int ans;void dfs(int u,int fa){ dp[u] = W[u]; for(int i=0;i<G[u].size();... 阅读全文
posted @ 2013-08-27 23:30 等待最好的两个人 阅读(145) 评论(0) 推荐(0)
摘要:题目链接:http://poj.org/problem?id=1050#include#include#include#includeusing namespace std;const int maxn = 105;const int INF = 0x3f3f3f;int dp[maxn];int sum[maxn][maxn];int ans;int main(){ //freopen("E:\\acm\\input.txt","r",stdin); int N; cin>>N; for(int i=0;i<=N;i++) sum[0 阅读全文
posted @ 2013-08-27 22:47 等待最好的两个人 阅读(151) 评论(0) 推荐(0)
摘要:题目链接:http://poj.org/problem?id=2127 #include#include#include#includeusing namespace std;const int maxn = 510;int dp[maxn][maxn];int a[maxn],b[maxn];pair > Max[maxn];pair pre[maxn][maxn];void print(int x,int y){ if(x>0 && y>0 && dp[x][y] > 0){ print(pre[x][y].first,pre[x][ 阅读全文
posted @ 2013-08-27 19:54 等待最好的两个人 阅读(133) 评论(0) 推荐(0)
摘要:题目链接:http://lightoj.com/volume_showproblem.php?problem=1021#include#include#include#includeusing namespace std;const int maxn = 1>T; for(int cas=1;cas='0' && s[i] <= '9') num[i] = s[i] - '0'; else num[i] = 10 + s[i] - 'A'; } memset(dp,0,sizeof(dp)); ... 阅读全文
posted @ 2013-08-27 11:16 等待最好的两个人 阅读(324) 评论(0) 推荐(0)
摘要:题目链接:http://poj.org/problem?id=3254#include #include #include #include #include #include #include using namespace std;const int moder = 1e8;const int maxe = 50000;const int maxn = 13;const int INF = 0x3f3f3f;int dp[maxn][1>M>>N; for(int i=1;i<=M;i++){ G[i] = 0; for(int j=0;j<N;j++)... 阅读全文
posted @ 2013-08-26 22:21 等待最好的两个人 阅读(272) 评论(0) 推荐(0)
摘要:题目链接:http://lightoj.com/volume_showproblem.php?problem=1018#include #include #include #include #include #include #include using namespace std;const int maxe = 50000;const int maxn = 16;const int INF = 0x3f3f3f;int X[maxn],Y[maxn];int S[maxn][maxn];int T,N;int dp[1>T; for(int cas=1;cas<=T;cas++ 阅读全文
posted @ 2013-08-26 19:30 等待最好的两个人 阅读(184) 评论(0) 推荐(0)
摘要:题目链接:http://lightoj.com/volume_showproblem.php?problem=1017#include #include #include #include #include #include #include using namespace std;const int maxe = 50000;const int maxn = 105;const int INF = 0x3f3f3f;int main(){ //freopen("E:\\acm\\input.txt","r",stdin); int Y[maxn]; i 阅读全文
posted @ 2013-08-26 14:02 等待最好的两个人 阅读(159) 评论(0) 推荐(0)
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4499//主要剪枝:避免与以前枚举的发生冲突。要回溯即把G[x][y]归零。#include #include #include #include #include #include #include using namespace std;const int maxe = 50000;const int maxn = 10;const int INF = 0x3f3f3f;int N,M,Q;int G[maxn][maxn];int ans;void dfs(int x,int y,int v. 阅读全文
posted @ 2013-08-25 10:48 等待最好的两个人 阅读(226) 评论(0) 推荐(0)
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4597#include #include #include #include #include #include #include using namespace std;const int maxe = 50000;const int maxn = 26;const int INF = 0x3f3f3f;int dp[maxn][maxn][maxn][maxn]; //dp[l1][r1][l2][r2] 表示先手与后手取得到的最大差值。bool vis[maxn][maxn][maxn][.. 阅读全文
posted @ 2013-08-25 08:40 等待最好的两个人 阅读(288) 评论(0) 推荐(0)
摘要:题目链接:http://poj.org/problem?id=1631#include #include #include #include #include #include #include using namespace std;const int maxe = 50000;const int maxn = 40050;const int INF = 0x3f3f3f;int main(){ //freopen("E:\\acm\\input.txt","r",stdin); int T; cin>>T; while(T--){ int 阅读全文
posted @ 2013-08-23 15:42 等待最好的两个人 阅读(145) 评论(0) 推荐(0)
摘要:题目链接:http://poj.org/problem?id=1609#include #include #include #include #include #include #include using namespace std;const int maxe = 50000;const int maxn = 105;const int INF = 0x3f3f3f;int main(){ //freopen("E:\\acm\\input.txt","r",stdin); int N; int dp[maxn][maxn]; int B[maxn] 阅读全文
posted @ 2013-08-23 13:57 等待最好的两个人 阅读(217) 评论(0) 推荐(0)
摘要:题目链接:http://lightoj.com/volume_showproblem.php?problem=1198#include #include #include #include #include #include #include using namespace std;const int maxn = 150;const int maxe = 5000;const int INF = 0x3f3f3f;struct Edge{ int u,v,flow,cap,cost; int next; Edge(int u=0,int v=0,int flow=0,int... 阅读全文
posted @ 2013-08-23 12:18 等待最好的两个人 阅读(222) 评论(0) 推荐(0)
摘要:就像1、2元人民币可以凑成任意你想要的面值一样。由于一定会有环,只要有C[i] == 1 就可以造成任何数。够坑吧#include #include #include #include #include #include #include using namespace std;const int maxe = 50000;const int maxn = 1e5+5;const int INF = 0x3f3f3f;int main(){ int C[maxn],T[maxn]; int N,Q; while(cin>>N>>Q){ bool flag = ... 阅读全文
posted @ 2013-08-22 19:42 等待最好的两个人 阅读(219) 评论(0) 推荐(0)
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4705#pragma comment(linker, "/STACK:16777216")#include #include #include #include #include #include #include using namespace std;const int maxn = 110010;long long dp[maxn];vector G[maxn];long long num[maxn];long long N;long long ans;void dfs(i 阅读全文
posted @ 2013-08-22 19:38 等待最好的两个人 阅读(205) 评论(0) 推荐(0)
摘要:题目链接:http://lightoj.com/volume_showproblem.php?problem=1013#include #include #include #include #include #include #include using namespace std;const int maxn = 35;const int INF = 0x3f3f3f;int main(){ //freopen("E:\\acm\\input.txt","r",stdin); int T; cin>>T; for(int t=1;t dp1 阅读全文
posted @ 2013-08-21 21:18 等待最好的两个人 阅读(195) 评论(0) 推荐(0)
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4322#include #include #include #include #include #include #include using namespace std;const int maxe = 50000;const int maxn = 30;const int INF = 0x3f3f3f;struct Edge{ int u,v,flow,cap,cost; int next; Edge(int u=0,int v=0,int flow=0,int cap=0,... 阅读全文
posted @ 2013-08-21 19:09 等待最好的两个人 阅读(176) 评论(0) 推荐(0)
摘要:由于暂时不会KM算法,只能用最大费用流来做了。题目链接:http://lightoj.com/volume_showproblem.php?problem=1011#include #include #include #include #include #include #include using namespace std;const int maxe = 50000;const int maxn = 500;const int INF = 0x3f3f3f;struct Edge{ int u,v,flow,cap,cost; int next; Edge(int u... 阅读全文
posted @ 2013-08-21 15:25 等待最好的两个人 阅读(256) 评论(0) 推荐(0)
摘要:题目链接:http://lightoj.com/volume_showproblem.php?problem=1005#include #include #include #include #include #include #include using namespace std;const int maxe = 50000;const int maxn = 50;const int INF = 0x3f3f3f;float dp[maxn];long long C[maxn][maxn];long long A[maxn][maxn];int main(){ //freopen(" 阅读全文
posted @ 2013-08-21 14:27 等待最好的两个人 阅读(154) 评论(0) 推荐(0)
摘要:题目链接:http://lightoj.com/volume_showproblem.php?problem=1004#include #include #include #include #include #include #include using namespace std;const int maxe = 50000;const int maxn = 105;const int INF = 0x3f3f3f;int num[maxn*2][maxn];int dp[maxn*2][maxn];int main(){ // freopen("E:\\acm\\input.tx 阅读全文
posted @ 2013-08-21 11:26 等待最好的两个人 阅读(290) 评论(0) 推荐(1)
摘要:题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=1760#include #include #include #include #include #include #include #define maxn 105#define maxe 100000using namespace std;const int INF = 0x3f3f3f;struct Edge{ int u,v,flow,cap; int next; Edge(int u=0,int v=0,int flow=0,int cap... 阅读全文
posted @ 2013-08-19 16:38 等待最好的两个人 阅读(174) 评论(0) 推荐(0)
摘要:题目链接:http://poj.org/problem?id=1149#include #include #include #include #include #include #include #define maxn 1050#define maxe 200000using namespace std;const int INF = 0x3f3f3f;struct Edge{ int u,v,flow,cap; int next; Edge(int u=0,int v=0,int flow=0,int cap=0,int next=0): u(u),v(v... 阅读全文
posted @ 2013-08-19 11:34 等待最好的两个人 阅读(136) 评论(0) 推荐(0)
摘要:题目链接:http://poj.org/problem?id=3281#include #include #include #include #include #include #include #define maxn 105#define maxe 20000using namespace std;const int INF = 0x3f3f3f;struct Edge{ int u,v,flow,cap; int next; Edge(int u=0,int v=0,int flow=0,int cap=0,int next=0): u(u),v(v),... 阅读全文
posted @ 2013-08-19 10:40 等待最好的两个人 阅读(168) 评论(0) 推荐(0)
摘要:题目链接:http://lightoj.com/volume_showproblem.php?problem=1300边双连通分量首先dfs找出桥并标记,然后dfs交叉着色找奇圈上的点。这题只要求在奇圈上的点个数。容易得到,一个边双联通分量如果存在奇圈,那么整个分量上的点都属于某个奇圈。#include#include#include#include#include#include#includeusing namespace std;const int maxn = 11150;const int maxe = 30100;const int INF = 0x3f3f3f;int pre[m 阅读全文
posted @ 2013-08-18 19:37 等待最好的两个人 阅读(221) 评论(0) 推荐(0)
摘要:题目链接:http://lightoj.com/volume_showproblem.php?problem=1291#include#include#include#include#include#include#includeusing namespace std;const int maxn = 11150;const int INF = 0x3f3f3f;int pre[maxn],low[maxn],dfs_clock;int bccnum[maxn],bcc_cnt; //记录每个点属于哪个边联通分量;bool isbridge[maxn*5]; //isbridge[i... 阅读全文
posted @ 2013-08-18 11:23 等待最好的两个人 阅读(206) 评论(0) 推荐(0)
摘要:题目链接:http://lightoj.com/volume_showproblem.php?problem=1063#include#include#include#include#include#include#includeusing namespace std;const int maxn = 10050;const int INF = 0x3f3f3f;vector G[maxn];int pre[maxn],low[maxn],dfs_clock;bool iscut[maxn];int ans;int n,m;void tarjan(int u,int fa){ pre[u... 阅读全文
posted @ 2013-08-17 22:59 等待最好的两个人 阅读(167) 评论(0) 推荐(0)
摘要:题目链接:http://lightoj.com/volume_showproblem.php?problem=1026#include#include#include#include#include#include#includeusing namespace std;const int maxn = 10050;const int INF = 0x3f3f3f;vector G[maxn];int pre[maxn],dfs_clock,low[maxn];struct ANS{ int l,r; bool operator pre[u]){ ans... 阅读全文
posted @ 2013-08-17 22:14 等待最好的两个人 阅读(178) 评论(0) 推荐(0)
摘要:这题的英语either...or....很蛋疼;m中,1:x与y至少一个出席;2:x出席,y随便,x不出席,y也不出席----这有个坑,可以推出y出席x也一定出席(这个关系必须要连上);3x与y至少一个不出席 4,x与y有且只有一个出席。对于k中的数据:我琢磨很久,关系在图上是建不了的,type为1时三个人至少有一个人要出席,则三个都不出席的情况是不允许的,dfs的时候判断一下就是了,同理type为2的情况。#include#include#include#include#include#include#includeusing namespace std;const int maxn = 1 阅读全文
posted @ 2013-08-17 17:04 等待最好的两个人 阅读(222) 评论(0) 推荐(0)
摘要:#include#include#include#include#include#include#includeusing namespace std;const int maxn = 20050;const int INF = 0x3f3f3f;int n,m;char a[maxn][2];int b[maxn][2];struct TwoSat{ int n; vector G[maxn*2]; bool mark[2*maxn]; int s[2*maxn],cnt; void init(int n){ this->n = n; ... 阅读全文
posted @ 2013-08-17 13:37 等待最好的两个人 阅读(289) 评论(0) 推荐(0)
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4681#include#include#include#include#include#include#includeusing namespace std;const int maxn = 1010;const int INF = 0x3f3f3f;char a[maxn],b[maxn],c[maxn];int dp1[maxn][maxn];int dp2[maxn][maxn];void Lcs1(char* s1,char* s2,int m,int n){ for(int i=1;... 阅读全文
posted @ 2013-08-16 09:30 等待最好的两个人 阅读(169) 评论(0) 推荐(0)
摘要:题目链接:http://poj.org/problem?id=3608#include#include#include#include#include#includeusing namespace std;const int maxn = 10500;const int maxe = 100000;const int INF = 0x3f3f3f;const double eps = 1e-8;const double PI = acos(-1.0);struct Point{ double x,y; Point(double x=0, double y=0) : x(x),y(y... 阅读全文
posted @ 2013-08-14 23:06 等待最好的两个人 阅读(244) 评论(0) 推荐(0)
摘要:题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=4199没想透为啥旋转卡壳跟枚举跑时间差不多。n太小吧!枚举法:#include#include#include#include#include#includeusing namespace std;const int maxn = 100050;const int maxe = 100000;const int INF = 0x3f3f3f;const double ep 阅读全文
posted @ 2013-08-14 19:24 等待最好的两个人 阅读(192) 评论(0) 推荐(0)
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4666#include #include #include #include #include #include using namespace std;const int maxn = 60060;struct MaxHeap{ int d; //k维的各种加或减的和; int p; //每个坐标和所属的标号 MaxHeap(int d=0,int p=0):d(d),p(p) {} boo... 阅读全文
posted @ 2013-08-14 18:54 等待最好的两个人 阅读(246) 评论(0) 推荐(0)
摘要:题目链接:http://poj.org/problem?id=2926#include#include#include#include#include#include#includeusing namespace std;const int INF = 0x3f3f3f;float Max[32]; //Max[i]表示第i种的最大;float Min[32];int N;int main(){ //freopen("E:\\acm\\input.txt","r",stdin); cin>>N; for(int i=0;i<32;i++ 阅读全文
posted @ 2013-08-14 16:59 等待最好的两个人 阅读(163) 评论(0) 推荐(0)
摘要:题目链接:http://poj.org/problem?id=2187旋转卡壳算法:http://www.cppblog.com/staryjy/archive/2009/11/19/101412.html或 http://cgm.cs.mcgill.ca/~orm/rotcal.frame.html#include#include#include#include#include#includeusing namespace std;const int maxn = 55000;const int maxe = 100000;const int INF = 0x3f3f3f;const dou 阅读全文
posted @ 2013-08-12 21:34 等待最好的两个人 阅读(196) 评论(0) 推荐(0)
摘要:题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1593#include#include#include#include#include#includeusing namespace std;const int maxn = 606;const int maxe = 100000;const int INF = 0x3f3f3f;const double eps = 1e-8;const double PI = acos 阅读全文
posted @ 2013-08-12 16:19 等待最好的两个人 阅读(189) 评论(0) 推荐(0)
摘要:题目链接:http://poj.org/problem?id=2318#include#include#include#include#include#includeusing namespace std;const int maxn = 5105;const int maxe = 20000;const int INF = 0x3f3f3f;const double eps = 1e-8;const double PI = acos(-1.0);struct Point{ double x,y; Point(double x=0, double y=0) : x(x),y(y){... 阅读全文
posted @ 2013-08-11 22:31 等待最好的两个人 阅读(185) 评论(0) 推荐(0)
摘要:题目链接:http://poj.org/problem?id=1269#include#include#include#include#include#includeusing namespace std;const int maxn = 105;const int maxe = 20000;const int INF = 0x3f3f3f;const double eps = 1e-8;const double PI = acos(-1.0);struct Point{ double x,y; Point(double x=0, double y=0) : x(x),y(y){ ... 阅读全文
posted @ 2013-08-11 21:50 等待最好的两个人 阅读(145) 评论(0) 推荐(0)
摘要:题目链接:http://poj.org/problem?id=3304#include#include#include#include#include#includeusing namespace std;const int maxn = 105;const int maxe = 20000;const int INF = 0x3f3f3f;const double eps = 1e-8;const double PI = acos(-1.0);struct Point{ double x,y; Point(double x=0, double y=0) : x(x),y(y){ ... 阅读全文
posted @ 2013-08-11 21:26 等待最好的两个人 阅读(219) 评论(0) 推荐(0)
摘要:题目链接:http://poj.org/problem?id=1556#include#include#include#include#include#includeusing namespace std;const int maxn = 1000;const int maxe = 20000;const int INF = 0x3f3f3f;const double eps = 1e-8;const double PI = acos(-1.0);struct Point{ double x,y; Point(double x=0, double y=0) : x(x),y(y){... 阅读全文
posted @ 2013-08-11 17:46 等待最好的两个人 阅读(169) 评论(0) 推荐(0)
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1520#include#include#include#include#include#include#includeusing namespace std;const int maxn = 6050;const int maxe = 10000;const int INF = 0x3f3f3f;struct Edge{ int u,v; int next; void assign(int u_,int v_,int next_){ u = u_; v = v_... 阅读全文
posted @ 2013-08-10 19:44 等待最好的两个人 阅读(178) 评论(0) 推荐(0)
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3409参考博客:http://www.cnblogs.com/woaishizhan/p/3189813.html#include#include#include#include#include#include#includeusing namespace std;const int maxn = 205;const int maxe = 20500;const int INF = 0x3f3f3f;struct Edge{ int u,v,w; int next; void as... 阅读全文
posted @ 2013-08-10 19:39 等待最好的两个人 阅读(372) 评论(0) 推荐(0)
摘要:题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=2896大概思路:A和B运动,以A(Posa)为参考点,求出B的运动轨迹(Posb -> Posb + Vb-Va);#include#include#include#include#include#includeusing namespace std;const int maxn = 60;const int maxe = 100000;const int INF 阅读全文
posted @ 2013-08-07 22:16 等待最好的两个人 阅读(252) 评论(0) 推荐(0)
摘要:题目链接:https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1264#include#include#include#include#include#includeusing namespace std;const int maxn = 310;const int maxe = 100000;const int INF = 0x3f3f3f;struct Point{ double x,y; Point(double 阅读全文
posted @ 2013-08-07 16:38 等待最好的两个人 阅读(230) 评论(0) 推荐(0)
摘要:#include#include#include#include#include#include#includeusing namespace std;struct Point{ double x,y; Point(double x=0, double y=0) : x(x),y(y){ } //构造函数};typedef Point Vector;Vector operator + (Vector A , Vector B){return Vector(A.x+B.x,A.y+B.y);}Vector operator - (Vector A , Vector B){ret... 阅读全文
posted @ 2013-08-07 14:55 等待最好的两个人 阅读(133) 评论(0) 推荐(0)
摘要:题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=1706trick:关于正数和负数的整除问题,正数整除是自动向下取整的,但负数是向上取整的即13/3=4.3 ->4 但-13/3=-4.3 ->-4#include #include #include #include #include #include #include #define maxn 32500#define maxe 11000#define INF 0x3f3f3f#define lson l,mid,u mid) Update(... 阅读全文
posted @ 2013-08-05 01:50 等待最好的两个人 阅读(230) 评论(0) 推荐(0)
摘要:题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3365#include #include #include #include #include #include #include #define maxn 50500#define maxe 11000#define INF 0x3f3f3fusing namespace std; int a[maxn],b[maxn];int main(){ //freopen("input.txt","r",stdin); int 阅读全文
posted @ 2013-08-04 21:47 等待最好的两个人 阅读(224) 评论(0) 推荐(0)
摘要:题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=2404#include #include #include #include #include #include #include #define maxn 550#define maxe 100000 #define INF 0x3f3f3fusing namespace std;struct Edge{ int from,to,cap,flow,cost; int next; void assign(int a,int b,int c,i... 阅读全文
posted @ 2013-08-04 18:24 等待最好的两个人 阅读(265) 评论(0) 推荐(0)
摘要:题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=2836#include #include #include #include #include #include #include #define maxn 15#define INF 0x3f3f3fusing namespace std;int a[maxn];int N;long long ans,M;int gcd(int a,int b){ //printf("%d %d\n",a,b); if(a%b == 0) return b 阅读全文
posted @ 2013-08-04 18:22 等待最好的两个人 阅读(187) 评论(0) 推荐(0)
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3357#include #include #include #include #include #include #include #define maxn 250#define maxe 100050#define INF 0x3f3f3fusing namespace std;int N,T;int ans;bool G[maxn][maxn];int l[maxn];int r[maxn];int lhead,ltail,rhead,rtail;int main(){ //freope... 阅读全文
posted @ 2013-08-04 02:11 等待最好的两个人 阅读(218) 评论(0) 推荐(0)
摘要:题目链接:http://poj.org/problem?id=3207#include #include #include #include #include #include #include #define maxn 1050#define maxe 550 #define INF 0x3f3f3fusing namespace std;struct TwoSat{ int n; vector G[maxe*2]; bool mark[maxe*2]; int s[maxe*2],cnt; void init(int n){ this-... 阅读全文
posted @ 2013-08-04 02:07 等待最好的两个人 阅读(168) 评论(0) 推荐(0)
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3062#include #include #include #include #include #include #include #define maxn 1250#define INF 0x3f3f3fusing namespace std;struct TwoSat{ int n; vector G[maxn*2]; bool mark[maxn*2]; int s[maxn*2],cnt; void init(int n){ this-... 阅读全文
posted @ 2013-08-04 02:05 等待最好的两个人 阅读(177) 评论(0) 推荐(0)
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4632用点容斥原理转移状态,dp[i][j]=dp[i+1][j]+dp[i][j-1]-dp[i+1][j-1]当 s[i] == s[j], 要加上dp[i+1][j-1] + 1;我就是想的太复杂,而这个题有卡时间,无限TLE,悲剧啊!#include #include #include #include #include #include #include #define maxn 1050#define INF 0x3f3f3fusing namespace std;const int.. 阅读全文
posted @ 2013-08-02 17:22 等待最好的两个人 阅读(214) 评论(1) 推荐(0)
摘要:题目链接:http://poj.org/problem?id=3469#include #include #include #include #include #include #include #define maxn 23000#define maxe 242000 using namespace std;const int INF = 0x3f3f3f;struct Edge{ int from,to,cap,flow; int next;};struct Dinic{ int s,t; int head[maxn]; int cur[maxn]; E... 阅读全文
posted @ 2013-08-02 11:53 等待最好的两个人 阅读(140) 评论(0) 推荐(0)
摘要:题目链接:http://poj.org/problem?id=1236#include #include #include #include #include #include #include #define maxn 105#define INF 0x3f3f3fusing namespace std;bool G1[maxn][maxn],G2[maxn][maxn];vector s;int vis[maxn],sccnum[maxn],scc_cnt;int N;int in[maxn],out[maxn];/* void dfs(int u){ vis[u] = true;... 阅读全文
posted @ 2013-08-02 01:00 等待最好的两个人 阅读(158) 评论(0) 推荐(0)
摘要:题目链接:http://poj.org/problem?id=1161#include #include #include #include #include #include #include #define maxn 400#define INF 0x3f3f3f#define min(a,b) (a>b?b:a)using namespace std;int first[maxn][maxn]; int d[maxn][maxn];vector G[maxn];int N,M,L;int mem[35];void floyd(){ for(int k=1;k<=M;k++) 阅读全文
posted @ 2013-08-01 22:24 等待最好的两个人 阅读(171) 评论(0) 推荐(0)