/* @链表法解决hash冲突 * 大单元数组,小单元链表 */ #pragma once #include using namespace std; template struct Node { size_t key; map_t content; Node *next; bool isEmpty... ...
分类:
其他好文 时间:
2017-10-15 21:10:43
阅读次数:
198
http://codeforces.com/gym/101498/problem/F 对于知道使用情况的置换算法,最优解是找一个最后需要使用的物品替换掉 也就是,如果一个物品后面已经不需要用到,就要拿出来了,碍地方 #include <bits/stdc++.h> #define IOS ios:: ...
分类:
其他好文 时间:
2017-10-07 14:47:23
阅读次数:
111
vector的erase方法注意点!!! C++11是这样的: iterator erase (const_iterator position); iterator erase (const_iterator first, const_iterator last); vector::erase(): ...
分类:
其他好文 时间:
2017-10-05 13:04:46
阅读次数:
197
219. Contains Duplicate II【easy】 Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array suc ...
分类:
其他好文 时间:
2017-10-03 12:00:28
阅读次数:
173
# -*- coding:utf-8 -*-from sys import argv script, filename = argv print "We're going to erase %r." % filenameprint "If you don't want that, hit CTRL- ...
分类:
编程语言 时间:
2017-10-02 13:58:26
阅读次数:
247
在vector中删除,大家都知道,直接erase的话,这种写法很有问题。因为erase(iter)之后iter指针就变成野指针了,此时继续iter++就会出问题。 因此vector中正确的删除的方法是: 但是在map中,正确的删除方法是: 因为对于map这种以指针构建起来的容器来说,可以保证一个元素 ...
分类:
其他好文 时间:
2017-09-22 12:08:03
阅读次数:
167
显示串口波特率等信息: stty -F /dev/ttyTHS2 -a #dev/ttyTHS2为选择的端口号 参数设置: stty -F /dev/ ttyTHS2 ispeed 115200 ospeed 115200 cs8 配置波特率115200数据8bit,一般情况下设置这两个参数就可以了 ...
分类:
系统相关 时间:
2017-09-18 20:39:36
阅读次数:
426
智能指针用于解决常规指针所带来的内存泄露、重复释放、野指针等内存问题。智能指针基于这样的事实得以发挥作用:定义在栈中的智能指针,当超出其作用域时,会自动调用它的析构函数,从而可以释放其关联的内存资源。 之前C++标准库中定义的智能指针std::auto_ptr<T>,因其设计存在缺陷,所以已不再推荐 ...
分类:
其他好文 时间:
2017-09-07 23:04:14
阅读次数:
223