标签:des style blog io color os ar java for
6 3 3 1 1 1 2 1 3 2 1 2 3 3 1 0
3#include<stdio.h> #include<string.h> int map[1010][1010],girl[1010],visit[1010],m,n; bool find(int x) { int j; for(j=1;j<=n;j++) { if(map[x][j]==true&&visit[j]==0){ visit[j]=1; if(girl[j]==0||find(girl[j])) { girl[j]=x; return true; } } } return false; } int main() { int k,i,a,b; while(scanf("%d",&k),k) { memset(map,0,sizeof(map)); memset(girl,0,sizeof(girl)); scanf("%d %d",&m,&n); for(i=1;i<=k;i++) { scanf("%d %d",&a,&b); map[a][b]=1; } int ans=0; for(i=1;i<=m;i++) { memset(visit,0,sizeof(visit)); if(find(i)) ans++; } printf("%d\n",ans); } return 0; }
标签:des style blog io color os ar java for
原文地址:http://blog.csdn.net/hdd871532887/article/details/40592379