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 Sayakiss at 2011-10-02 15:21:14 on Problem 2411
In Reply To:25行代码流出 Posted by:Sayakiss at 2010-08-09 18:51:37
> #include<cstdio>
> #include<cstring>
> long long f[30][1<<12],i,j,n,m,saya=1;
> void sayatime (int i,int s1,int pos)
> {
> 	if (pos==m) {f[i][s1]+=saya;return;}
> 	sayatime(i,s1,pos+1);
> 	if (pos<=m-2&&!(s1&1<<pos)&&!(s1&1<<pos+1)) sayatime(i,s1|1<<pos|1<<pos+1,pos+2);
> }
> int main()
> {
> 	
> 	while(scanf("%d%d",&n,&m),n!=0)
> 	{
> 	memset(f,0,sizeof(f));saya=1;
> 	sayatime(1,0,0);
> 	for (i=2;i<=n;i++)
> 	for (j=0;j<1<<m;j++)
> 	{
> 		if (f[i-1][j]) saya=f[i-1][j]; else continue;
> 		sayatime(i,~j&((1<<m)-1),0);
> 	}
> 	printf("%lld\n",f[n][(1<<m)-1]);
> 	}
> }

年轻时候写的渣代码……还喜欢显摆……哎……

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