标签:chmod content panel ane href class .com output ram
http://acm.hdu.edu.cn/showproblem.php?pid=2119
Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
#include<cstdio> #include<cstring> using namespace std; int n,m,a[101][101]; int tot,front[101],nxt[10010],to[10010]; int match[101],ans; bool v[101]; void add(int u,int v) { to[++tot]=v; nxt[tot]=front[u]; front[u]=tot; } bool go(int u) { for(int i=front[u];i;i=nxt[i]) { if(!v[to[i]]) { v[to[i]]=true; if(!match[to[i]]||go(match[to[i]])) { match[to[i]]=u; return 1; } } } return 0; } int main() { while(scanf("%d",&n)) { if(!n) return 0; scanf("%d",&m); ans=0; tot=0; memset(front,0,sizeof(front)); memset(match,0,sizeof(match)); for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) { scanf("%d",&a[i][j]); if(a[i][j]) add(i,j); } for(int i=1;i<=n;i++) { memset(v,0,sizeof(v)); if(go(i)) ans++; } printf("%d\n",ans); } }
标签:chmod content panel ane href class .com output ram
原文地址:http://www.cnblogs.com/TheRoadToTheGold/p/7103560.html