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

## Re:20L（有缩行之嫌）纯二进制滚动DP(428K 16MS可惜打表之下神马都是浮云)

Posted by zhsl at 2013-02-28 21:09:31 on Problem 2411
In Reply To:20L（有缩行之嫌）纯二进制滚动DP(428K 16MS可惜打表之下神马都是浮云) Posted by:kill_myself at 2011-04-09 23:47:36
```> 8461762 kill_myself 2411 Accepted 428K 16MS G++ 584B 2011-04-09 23:42:09
> #include<cstdio>
> #include<string.h>
> long long f[2][4100],a,b,n,m,k,j,p;
> int main(){
>    while(scanf("%d%d",&n,&m),memset(f,0,sizeof(f)),f[0][0]=p=1,a=n>m?n:m,b=n+m-a){
>       while(a--)
>        for(j=0;++j<=b;memset(f[p=1-p],0,sizeof(f[p])))
>            for(k=(1<<b);--k+1;)
>               if(k&1<<j-1)
>                  f[p][k&~(1<<j-1)]+=f[1-p][k];
>               else{
>                    f[p][k|1<<j-1]+=f[1-p][k];
>                    if(j<b&&!(k&1<<j))
>                       f[p][k|1<<j]+=f[1-p][k];
>               }
>       printf("%lld\n",f[1-p][0]);
>    }
> }
>
Orz。。。```

Followed by: