2013
12-09

# Mondriaan’s Dream

Squares and rectangles fascinated the famous Dutch painter Piet Mondriaan. One night, after producing the drawings in his ‘toilet series’ (where he had to use his toilet paper to draw on, for all of his paper was filled with squares and rectangles), he dreamt of filling a large rectangle with small rectangles of width 2 and height 1 in varying ways.
Expert as he was in this material, he saw at a glance that he’ll need a computer to calculate the number of ways to fill the large rectangle whose dimensions were integer values, as well. Help him, so that his dream won’t turn into a nightmare!

The input file contains several test cases. Each test case is made up of two integer numbers: the height h and the width w of the large rectangle. Input is terminated by h=w=0. Otherwise, 1<=h,w<=11.

For each test case, output the number of different ways the given rectangle can be filled with small rectangles of size 2 times 1. Assume the given large rectangle is oriented, i.e. count symmetrical tilings multiple times.

1 2
1 3
1 4
2 2
2 3
2 4
2 11
4 11
0 0

1
0
1
2
3
5
144
51205

#include <string.h>
#include <stdio.h>
#include <set>
typedef long long LL;
int h,w,full;
LL d[12][2200],res[12][12];
int doublei(int state){
for(int i=0,d=0;i<=w;i++)
if(i<w&&((state>>i)&1))d++;
else if(d&1)return 0;
return 1;
}
LL dfs(int state,int step){
if(d[step][state]!=-1)return d[step][state];
if(step==h)return state==full-1;
d[step][state]=0;
for(int i=0;i<full;i++){
if((i|state)!=full-1||!doublei(state&i))continue;
d[step][state]+=dfs(i,step+1);
}
return d[step][state];
}
int main(){
while(scanf("%d%d",&h,&w),h||w){
if(res[w][h])printf("%I64d\n",res[w][h]);
else{
full=(1<<w);
memset(d,-1,sizeof d);
printf("%I64d\n",res[w][h]=res[h][w]=dfs(full-1,0));
}
}
return 0;
}

1. 第2题，TCP不支持多播，多播和广播仅应用于UDP。所以B选项是不对的。第2题，TCP不支持多播，多播和广播仅应用于UDP。所以B选项是不对的。

2. 问题3是不是应该为1/4 .因为截取的三段，无论是否能组成三角形， x， y-x ，1-y,都应大于0，所以 x<y,基础应该是一个大三角形。小三角是大三角的 1/4.

3. Thanks for taking the time to examine this, I really feel strongly about it and love studying a lot more on this topic. If possible, as you acquire experience