摘要: 例子1 数字三角形 改进后: 改为从最后一行往上递推 空间优化 空间再次优化 例子2 最长上升子序列 人人为我型 例子3 最长公共子序列 例子4 最佳加法表达式 例子5 神奇的口袋 动规解法 我为人人解法 例子6 背包问题 节省空间 滚动一维数组解法 例子7 滑雪问题 阅读全文
posted @ 2018-05-22 02:00 Latticeeee 阅读(276) 评论(0) 推荐(0) 编辑
摘要: 例子1 全排列 n! 例子2:逆波兰表达式 例子3 普通表达式的计算 例子4:分割棋盘 #include <iostream>#include <cmath>#include <cstring>#include <iomanip>using namespace std; //棋盘分割 每个棋格都代表 阅读全文
posted @ 2018-05-21 17:24 Latticeeee 阅读(174) 评论(0) 推荐(0) 编辑
摘要: #include <cstdlib>#include <iostream>#include <string>#include <algorithm>using namespace std;class MyString:public string{ public: MyString():string( 阅读全文
posted @ 2018-03-28 10:27 Latticeeee 阅读(2046) 评论(0) 推荐(0) 编辑
摘要: 随手再奉上测试数据~ in 10203 4 5 6 7403 14 5 6 73040 50 60 70 8010010 20 30 40 5040020 3 300 60 981000332 90 47 8989 835000200 400 6 70 20400200 10 30 100 9001 阅读全文
posted @ 2018-03-27 00:03 Latticeeee 阅读(239) 评论(0) 推荐(0) 编辑
摘要: //__new__(cls[,....]) //对象实例化调用的第一个方法,它的第一个参数是这个类,而其他参数会直接传递给__init__()方法 //需要在基类的基础上对其进行修改时重写__new__()方法 //__del__()方法 //只有在该类实例化的对象全部被del掉时,才调用__del__()方法 //python 中的运算符重载 class New_int(int)... 阅读全文
posted @ 2018-03-25 12:20 Latticeeee 阅读(229) 评论(0) 推荐(0) 编辑
摘要: 例子: 例子: 例子: 阅读全文
posted @ 2018-03-25 11:54 Latticeeee 阅读(547) 评论(0) 推荐(0) 编辑
摘要: 写得虚脱,然而欣慰的是,它挺短 【捂脸】,最后debug,发现竟然是Case 首字母忘记大写......这告诉我们一个道理,要看清题目,注意细节 qwq 随手奉上测试数据~ 如果都正确应该就没问题了! //input 7 20 3 4 5 6 7 40 3 14 5 6 7 30 40 50 60 阅读全文
posted @ 2018-03-19 20:12 Latticeeee 阅读(253) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include using namespace std; const int MAX = 110; //终于过了的.... // 要记得判断字符串长度!~ class CHugeInt { char p[250]; ... 阅读全文
posted @ 2018-03-19 12:24 Latticeeee 阅读(248) 评论(0) 推荐(0) 编辑
摘要: //输出 9 22 5 #include using namespace std; class Sample { public: int v; Sample(int n){ v = n ; } Sample(){ } Sample(const Sample & a){ v = a.v + 2;... 阅读全文
posted @ 2018-03-10 10:33 Latticeeee 阅读(392) 评论(0) 推荐(0) 编辑
摘要: 问题描述:红球3个,黄球3个,绿球6个,从中任意摸出8个,求组合方式。 注意每个球能够取值的范围。 阅读全文
posted @ 2018-03-06 16:12 Latticeeee 阅读(731) 评论(0) 推荐(0) 编辑