摘要: 题目描述:我们可以用2*1的小矩形横着或者竖着去覆盖更大的矩形。请问用n个2*1的小矩形无重叠地覆盖一个2*n的大矩形,总共有多少种方法?输入:输入可能包含多个测试样例,对于每个测试案例,输入包括一个整数n(1 2 using namespace std; 3 4 long long res[71]; 5 6 void init() 7 { 8 res[0] = 1; 9 res[1] = 1;10 for (int i = 2; i > n) {21 cout << res[n] << endl;22 }23 return 0;24... 阅读全文
posted @ 2014-04-09 17:22 Eason Liu 阅读(170) 评论(0) 推荐(0) 编辑
摘要: Given an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999.纯模拟:基本字符IVXLCDM相应的阿拉伯数字表示为1510501005001000相同的数字连写,所表示的数等于这些数字相加得到的数,如:Ⅲ = 3;小的数字在大的数字的右边,所表示的数等于这些数字相加得到的数, 如:Ⅷ = 8;Ⅻ = 12;小的数字,(限于Ⅰ、X 和C)在大的数字的左边,所表示的数等于大数减小数得到的数,如:Ⅳ= 4;Ⅸ= 9;正常使用时,连写的数字重复不得超过三 阅读全文
posted @ 2014-04-09 14:38 Eason Liu 阅读(2232) 评论(0) 推荐(0) 编辑
摘要: Given a stringsand a dictionary of wordsdict, determine ifscan be segmented into a space-separated sequence of one or more dictionary words.For exampl... 阅读全文
posted @ 2014-04-09 14:09 Eason Liu 阅读(1894) 评论(0) 推荐(0) 编辑