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

我再交个HLPP版的。。。

Posted by JiangLY at 2007-01-23 09:47:48 on Problem 1000
In Reply To:...代码内附 Posted by:JiangLY at 2007-01-23 09:46:46
> #include<stdio.h>
> #include<string.h>
> 
> int c[4][4],f[4][4];
> bool b[4];
> int ans;
> 
> void init()
> {
>     int a,b;
>     scanf("%d%d",&a,&b);
>     c[0][1]=a;c[1][3]=a;
>     c[0][2]=b;c[2][3]=b;
> }
> 
> bool find(int x)
> {
>     if(x==3)return true;
>     for(int i=0;i<4;i++)
>     {
>         if(f[x][i]<c[x][i]&&!b[i])
>         {
>             b[i]=true;
>             if(find(i))
>             {
>                 f[x][i]++;f[i][x]--;
>                 return true;
>             }
>         }
>     }
>     return false;
> }
> 
> void process()
> {
>     ans=0;
>     memset(b,false,sizeof(b));
>     b[0]=true;
>     while(find(0))
>     {
>         memset(b,false,sizeof(b));
>         b[0]=true;
>         ans++;
>     }
> }
> 
> int main()
> {
>     init();
>     process();
>     //if(ans!=a+b)ans=a+b;
>     printf("%d\n",ans);
> }
> 

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