题意:n*m网格1能放0不能放 放的格子不能相邻 求一共多少种可放的方案。分析:dp[i][j]第i行可行状态j的的最大方案数,枚举当前行和前一行的所有状态转移就行了(不放牛也算一种情况)#include #include #include #include #include #include #i...
分类:
其他好文 时间:
2015-07-24 17:26:38
阅读次数:
120
1.POJ - 3254 Corn Fields
题目大意:有一个n*m的草地(草地上有的是沼泽),现在要分配牛去上面吃草,要求每头牛不能相邻(不能有公共边),问有多少种分配方案,一头牛都不分配也算一种分配方案解题思路:这是碰到的第一道比较另类的压缩
1.首先考虑一下,每一行该怎么分配牛才不会让他们相邻,可以用状态压缩,0表示不放牛,1表示放牛,枚举一下有多少种可行的方案并纪录下来2.接着考虑一...
分类:
其他好文 时间:
2015-07-24 12:48:20
阅读次数:
103
题目大意:有一个网格,网格上面有草地和荒地,现在要在这个方格上面放士兵,士兵只能放在草地上,不能放在荒地上,且士兵不能两两相连,问有多少种放士兵的方式(也可以一个士兵都不放)解题思路:这题和POJ - 1185 炮兵阵地类似,是简单版的,就不详说了,poj有点坑啊,我的数组开小了,给出的是WA,找了半天没找到。。。
现在给出1185的链接
这里写链接内容#include
#inc...
分类:
其他好文 时间:
2015-07-14 22:37:05
阅读次数:
183
Children of the Candy Corn
Time Limit: 1000MS
Memory Limit: 65536K
Total Submissions: 10881
Accepted: 4678
Description
The cornfield maze is a popular Halloween tre...
分类:
其他好文 时间:
2015-07-09 09:46:49
阅读次数:
120
Description:Find the total area covered by tworectilinearrectangles in a2Dplane.Each rectangle is defined by its bottom left corner and top right corn...
分类:
其他好文 时间:
2015-06-27 21:18:52
阅读次数:
118
在iOS中,比较偷懒的一种做法,实现文本的多行输入。并且带有自动换行的功能,可以用UITextView来比较偷懒的实现。
实现代码就比较简单:
UITextView *textView = [[UITextView
alloc] initWithFrame:CGRectMake(10,
100, 100,
40)];
textView.layer.corn...
分类:
移动开发 时间:
2015-06-23 17:54:40
阅读次数:
141
Description
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...
分类:
其他好文 时间:
2015-06-21 14:33:04
阅读次数:
155
POJ【3083】Children of the Candy Corn
Dfs+Bfs...
分类:
其他好文 时间:
2015-06-15 09:13:29
阅读次数:
120
CREATE TABLE CANDY_TBL SELECT * FROM PRODUCTS_TBL;INSERT INTO CANDY_TBL VALUES ('9', 'CANDY CORN', 1.35);SELECT * FROM CANDY_TBL;+---------+----------...
分类:
其他好文 时间:
2015-05-30 00:31:29
阅读次数:
157
Saving James Bond - Easy VersionAssume that the lake is a 100 by 100 square one. Assume that the center of the lake is at (0,0) and the northeast corn...
分类:
其他好文 时间:
2015-05-28 15:48:22
阅读次数:
167