C++学习笔记3--类
- 转换函数
- pointer-like class & function-like class
- 泛型编程
- 模板特化
这一部分主要介绍C++面向对象,多个类之间的关系。另外介绍了虚函数及其实现机制和一些设计模式。
http://www.sohu.com/a/153858619_466939
这里有一个漫画,解释的很清楚,算是比较好的动态规划算法入门资料了。
里面有两道经典的习题,爬梯子和挖金矿。分别是一维和二维的情况。
动态规划的三要素:
对应的算法有以下几种:
In LOL world, there is a hero called Teemo and his attacking can make his enemy Ashe be in poisoned condition. Now, given the Teemo’s attacking ascending time series towards Ashe and the poisoning time duration per Teemo’s attacking, you need to output the total time that Ashe is in poisoned condition.
You may assume that Teemo attacks at the very beginning of a specific time point, and makes Ashe be in poisoned condition immediately.
看着很复杂,实际上就是给一串时间点,给一个作用时间,计算Teemo的总的作用时间。
Given an array of 2n integers, your task is to group these integers into n pairs of integer, say (a1, b1), (a2, b2), …, (an, bn) which makes sum of min(ai, bi) for all i from 1 to n as large as possible.
Note:
- n is a positive integer, which is in the range of [1, 10000].
- All the integers in the array will be in the range of [-10000, 10000].