挺简单的DP,可是没有注意到数据会超范围,上官网搜了数据才知道,后来改成了__int64,发现还是不行,改成double,AC了带血的AC。。。#include<stdio.h>#include<string.h>double dp[110][15];int main(){ int k,n; int i,j; while(scanf("%d%d",&k,&n)!=EOF) { memset(dp,0,sizeof(dp)); for(i=1;i<=k+1;i++) dp[1][i]=1; for(i=2;i<=n;i++) Read More
posted @ 2011-11-18 20:14 Because Of You Views(242) Comments(0) Diggs(0) Edit
简单二分匹配,注意,输出的是n-最大匹配数#include<stdio.h>#include<string.h>#include<math.h>int match[110];bool map[110][110];struct point{ double x,y;}p[110],hole[110];double dis(point a,point b){ return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));}bool vis[110];int m;bool dfs(int u){ int i; for(i= Read More
posted @ 2011-11-18 16:17 Because Of You Views(262) Comments(1) Diggs(1) Edit
其实可以二分的,听说直接输入一扇门的信息,做一次SCC也能爆过,就直接暴力了,呵呵~每个门有两把锁,这就有了一种关系,假设两把锁是a,b,那么不开a就一定要开b,不开b就一定要开a,即b'->a,a'->b;另外还有n对矛盾关系,用了a钥匙就不能用b钥匙,a->b',b->a'然后,强连通求解#include<stdio.h>#include<string.h>#include<vector>#include<algorithm>using namespace std;const int M Read More
posted @ 2011-11-18 15:44 Because Of You Views(347) Comments(0) Diggs(0) Edit