题目大意:
FJ有一块n*m矩形农场,他知道每一个格子能不能种牧草。他想把一些格子种上牧草,但要求没有两个种牧草的各自是相邻的。求一共有多少种种法。
解题思路:
状态压缩:将每一行有几个格子种牧草用一个数来表示状态。判断有没有相邻用x&(x
下面是代码:
#include
#include
#include
#include
#include
using nam...
分类:
其他好文 时间:
2014-06-08 16:43:27
阅读次数:
241
题目
A message containing letters from A-Z is being encoded to numbers using
the following mapping:
'A' -> 1
'B' -> 2
...
'Z' -> 26
Given an encoded message containing digits, determine ...
分类:
其他好文 时间:
2014-06-08 15:30:08
阅读次数:
182
题目:For example, given s = "aab",
Return 1 since the palindrome partitioning ["aa","b"] could be produced using 1 cut
解题思路:给一个字符串,如果字符串可以划分成若干子回文字符串,返回最小的划分数量。
这个题如果还用之前求所有划分组合的循环加递归方法的话,就会得到超时的错误。这是就要考虑别的方法,动态规划倒是一个不错的方法,但是动态规划最重要的是要找到动态方程。本题的动态方程:
dp[i] =...
分类:
其他好文 时间:
2014-06-08 14:56:58
阅读次数:
257
题意:贪吃蛇的题目
思路:BFS+状态的记录,坑了无数发,#include
#include
#include
using namespace std;
const int MAXN = 500000;
bool flag[8],vis[25][25],mp[21][21][16384];
int n,m,l;
int xx[4]={-1,0,1,0}; // up,right,dow,left...
分类:
其他好文 时间:
2014-06-08 10:13:19
阅读次数:
204
下载了Hadoop预编译好的二进制包,hadoop-2.2.0.tar.gz,启动起来后,总是出现这种警告:
WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
原因是apache官...
分类:
其他好文 时间:
2014-06-08 09:47:47
阅读次数:
292
题目来源:Light OJ 1251 Forming the Council
题意:若干了条件至少满足一个 求是否有方案 输出任意一种可能的方案 留下的人的个数
思路:2-SAT基础题
#include
#include
#include
using namespace std;
const int maxn = 100010;
int n, m;
vector G[maxn*2];...
分类:
其他好文 时间:
2014-06-08 08:15:18
阅读次数:
261
using System;using System.Collections.Generic;using
System.Linq;using System.Web;using System.Text;using System.Data.SqlClient;using
System.Data;using...
分类:
数据库 时间:
2014-06-07 21:59:54
阅读次数:
335
下面是个人理解的单例模式:using System;using
System.Collections.Generic;using System.Linq;using System.Text;namespace
ConsoleApplication6{ public sealed class Si.....
分类:
其他好文 时间:
2014-06-07 21:55:56
阅读次数:
277
a题,就不说了吧b题,直接从大到小排序1-limit的所有数的lowbit,再从大到小贪心组成sum就行了 1 #include 2 #include 3
#include 4 #include 5 #define N 200000 6 using namespace std; ...
分类:
其他好文 时间:
2014-06-07 21:49:57
阅读次数:
272
#include#include#define LIST_INIT_SIZE
10/*线性表初始长度*/#define LIST_CREATENT 2/*每次的增量*/typedef int ElemType;using
namespace std;typedef struct SqList/*线性...
分类:
其他好文 时间:
2014-06-07 21:01:21
阅读次数:
322