POJ2443 Set Operation Time Limit: 3000MS Memory Limit: 65536K Total Submissions: 2679 Accepted: 1050 Description You are given N sets, the i-th set (represent by S(i)) have C(i) element (Here "set" isn't entirely the same as the "set&qu…
/* 给定一个二行n列的格子,在里面填黑白色,要求通过黑白色将格子分为k块 请问有多少种填色方式 dp[j][k][0,1,2,3] 填到第j列,有k块,第j列的颜色, */ #include<bits/stdc++.h> using namespace std; #define ll long long #define mod 998244353 //0全白,1黑白,2白黑,3黑黑 ll dp[][*][],n,k; int main(){ cin>>n>>k; me…
题目描述 Farmer John has purchased a lush new rectangular pasture composed of M by N (1 ≤ M ≤ 12; 1 ≤ N ≤ 12) square parcels. He wants to grow some yummy corn for the cows on a number of squares. Regrettably, some of the squares are infertile and can't b…
Maze Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 100000/100000 K (Java/Others) Total Submission(s): 901 Accepted Submission(s): 314 Problem Description This story happened on the background of Star Trek. Spock, the deputy captain of St…
题意:给出一个n行m列的草地,1表示肥沃,0表示贫瘠,现在要把一些牛放在肥沃的草地上,但是要求所有牛不能相邻,问你有多少种放法. 分析:假如我们知道第 i-1 行的所有的可以放的情况,那么对于第 i 行的可以放的一种情况,我们只要判断它和 i - 1 行的所有情况的能不能满足题目的所有牛不相邻,如果有种中满足,那么对于 i 行的这一中情况有 x 中放法. 但是我们又发现,状态是一种放法,不是我们平常dp的简单的状态,所以要用状态压缩! dp[i][j]表示第i行状态为j的个数. dp…