Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

求助,总是错,不知道怎么回事

Posted by gemini_yue at 2012-07-05 11:38:13 on Problem 2239
#include<iostream>
#include<cstring>
using namespace std;
int a[331][331],f[331];
bool t[331];
bool find(int x)
{
    int i;
    for(i=1;i<=a[x][0];i++)
        if(t[a[x][i]])
        {
            t[a[x][i]]=0;
            if((f[a[x][i]]==0)||(find(f[a[x][i]])))
            {
                f[a[x][i]]=x;
                return 1;
            }
        }
    return 0;
}
int main()
{
    int n,m,k,i,j,x,ans,p,q;
    cin>>n;
    memset(a,0,sizeof(a));
    memset(f,0,sizeof(f));
    for(i=1;i<=n;i++)
    {
        cin>>k;
        for(j=1;j<=k;j++)
        {
            cin>>p>>q;
            a[i][0]++;
            a[i][a[i][0]]=(p-1)*12+q;
        }
    }
    ans=0;
    for(i=1;i<=n;i++)
    {
        memset(t,1,sizeof(t));
        if(find(i)) ans++;
    }
    cout<<ans<<endl;
    return 0;

}
    

    

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator