一:vector异常类 Myexcep.h
#include
#include
using namespace std;
class Myexcep
{
public:
Myexcep() :m_exnote("Get a exception ") {}
Myexcep(const string &other){m_exnote = other;}
...
分类:
其他好文 时间:
2014-10-09 03:03:08
阅读次数:
116
//字符串分割函数std::vector split(std::string str,std::string pattern){ std::string::size_type pos; std::vector result; str+=pattern;//扩展字符串以方便操作 ...
分类:
编程语言 时间:
2014-10-09 02:33:37
阅读次数:
220
由于gas总量大于cost总量时,一定可以绕所有城市一圈。
第一种解法:
假设一开始有足够的油,从位置i出发,到位置k时剩余的油量为L(i,k)。
对任意的k,L(i,k)根据i的不同,只相差常数。
我们只需要找到最小的L(0, k)对应的k,k+1为所求。
代码如下:
int canCompleteCircuit(vector &gas, vector &cost) {
...
分类:
其他好文 时间:
2014-10-09 01:33:38
阅读次数:
175
1、简介Vector属于顺序容器,代表可改变大小的数组。像数组一样,vector使用连续存储,意味着它们的元素可以使用偏移来访问。不同于数组,它们的规模可以动态改变。Vectors are sequence containers representing arrays that can change...
分类:
编程语言 时间:
2014-10-09 00:26:07
阅读次数:
243
High Performance Python
目录
1
Understanding Performant Python2
Profiling3
Lists and Tuples4
Dictionaries and Sets5
Iterators and Generators6
Matrix and Vector Computation7
Compil...
分类:
编程语言 时间:
2014-10-08 11:03:25
阅读次数:
448
第一种思路是用一个vector存所有的Node*
之后再用两个指针将链表拼接出来
void reorderList(ListNode *head) {
vector content;
ListNode * cur = head;
while (cur)
{
content.push_back(cur...
分类:
其他好文 时间:
2014-10-08 03:15:24
阅读次数:
277
二分图解决这个问题的思路#include #include #include #include #include #include using namespace std;class Node{public:string name;vector adj;bool visited;int groupI...
分类:
其他好文 时间:
2014-10-08 01:24:14
阅读次数:
298
我们封装好了Buffer后,却不知道具体要多少个线程,一个一个线程的去关联Buffer太繁琐了。那么,我们是不是可以讲Buffer与线程的一个队列封装在一起呢 ?由于vector中不能存放Thread,所以,我们应在vector中添加相应的Thread *,这样,就可以完成封装了。声明代码如下: 1...
分类:
系统相关 时间:
2014-10-07 17:47:43
阅读次数:
274
(一)SVM的背景简单介绍支持向量机(Support Vector Machine)是Cortes和Vapnik于1995年首先提出的,它在解决小样本、非线性及高维模式识别中表现出很多特有的优势,并可以推广应用到函数拟合等其它机器学习问题中[10]。支持向量机方法是建立在统计学习理论的VC 维理论和...
分类:
其他好文 时间:
2014-10-07 15:20:53
阅读次数:
367
简单实现了构造、析构、push_back、pop_back、operator=、operator[]、clear等函数...
分类:
其他好文 时间:
2014-10-07 15:15:53
阅读次数:
193