用2个组合为3种情况,4,6,8......为2种情况
#include
#include
#include
using namespace std ;
const int maxn = 40 ;
typedef long long ll ;
ll a[maxn] ;
ll dp[maxn] ;
int main()
{
// freopen("in.txt","r",...
分类:
其他好文 时间:
2015-05-13 10:35:38
阅读次数:
101
打印输出 对于那些不想阅读手册,只需要一个简单的工具用于日志记录的人。你可以直接在控制台中输出日志信息,首先你需要包含头文件boost/log/trivial.hpp,然后编写下面的代码: #include #include int main(int, char*[]){ BOOST_LOG_TRI...
分类:
其他好文 时间:
2015-05-07 12:20:33
阅读次数:
1492
function trim(str){ //创建空格对象 var space = new String(" "); /* str = trimLeft(str,space); str = trimRight(str,space); */ return tri...
分类:
Web程序 时间:
2015-05-06 21:08:25
阅读次数:
242
Tilingc[0]=1,c[1]=1,c[2]=3; c[n]=c[n-1]+c[n-2]*2; 0<=n<=250. 大数加法java time :313ms 1 import java.util.*; 2 import jav...
分类:
其他好文 时间:
2015-05-05 23:29:27
阅读次数:
115
#include
#include
#include
using namespace std;
int mod;
int n;
struct node{
int s[6][6];
}aa;
void init(){
memset(aa.s,0,sizeof(aa.s));
aa.s[0][0]=aa.s[1][0]=aa.s[2][0]=aa.s[3][0]=1;
...
分类:
其他好文 时间:
2015-05-04 18:20:31
阅读次数:
145
【题目链接】click here~~
【题目大意】
In how many ways can you tile a 2xn rectangle by 2x1 or 2x2 tiles?
Here is a sample tiling of a 2x17 rectangle.
【解题思路】:
(1)一个2*2的格子有三种填充方法:
两个横着放,
两个竖着放,
放一...
分类:
其他好文 时间:
2015-04-29 11:53:06
阅读次数:
134
Description
Michael The Kid receives an interesting game set from his grandparent as his birthday gift. Inside the game set box, there are n tiling blocks and each block has a form as follows:
...
分类:
其他好文 时间:
2015-04-21 18:10:05
阅读次数:
227
简单的字典树题,首先简历字典树,在查找。
#include
using namespace std;
struct Tri
{
int v;
Tri* child[26];
} root;
void Init()
{
root.v=0;
for(int i=0;i<26;i++)
{
root.child[i]=NULL;
}
}
void CreateDic(ch...
分类:
其他好文 时间:
2015-04-21 09:46:41
阅读次数:
122
分析:字典树解决,注意节点里面只需要保存该点是否构成一个单词,和匹配类型的题有所区别;另外要注意重读打印。字典树效率高。
#include
using namespace std;
struct Tri
{
bool v;
Tri* child[26];
};
Tri* root;
void Init()
{
root->v=false;
for(int i=0;i<26;...
分类:
其他好文 时间:
2015-04-21 00:27:07
阅读次数:
148
题目大意:
有一个大小2*N的矩形地板,用规格为2*2和2*1的瓷砖方块去填满它,共有多少种方案
思路:
设长度为N的矩形地板共有F[N]种方案。共有三种放法:
先放一块2*2瓷砖方块,则F[N] = F[N-2]。
先放两块横着的1*2的瓷砖,则F[N] = F[N-2]。
先放一块竖着的2*1的瓷砖,则F[N] = F[N-1]。
总和一下,就是:F[N] = F[N-1] + 2*F[N-2]。
因为0 <= N <= 250,所以要用到高精度。用整型数组F[][]来计算,然后用字符型数组Fi[][...
分类:
其他好文 时间:
2015-04-18 10:05:13
阅读次数:
130