状态方程为dp[i][s]=dp[i-1][s']+dp[i-1][s] (sum[s]<i)或dp[i][s]=dp[i-1][s'] (sum[s]==i)如果s与base矛盾,则s'必须含有s与base矛盾的项。(其中i为第几行,s为状态,s'为是的子状态,base数组记录棋盘状态('.'为1,'#'为0),sum[s]记录s中1的个数)View Code #include<iostream>#include<cstdio>#include<string.h>using namesp Read More
posted @ 2013-04-25 22:15 longlongago Views(178) Comments(0) Diggs(0) Edit
具体做法可参照Matrix67大牛的博客http://www.matrix67.com/blog/archives/266View Code #include<cstdio>#include<string.h>#include<iostream>using namespace std;int up,n,k,sum;void test(int row,int ld,int rd,int cnt,int now){ if(now>n) return; if(cnt<k) { int pos=up&(~(ld|rd|row)); int p; Read More
posted @ 2013-04-25 00:08 longlongago Views(133) Comments(0) Diggs(0) Edit