[QQ群: 189191838,对算法和C++感兴趣可以进来] 直接逼入正题。Standard
Template
Library简称STL。STL可分为容器(containers)、迭代器(iterators)、空间配置器(allocator)、配接器(adaptors)、算法(algorit...
分类:
其他好文 时间:
2014-05-14 03:55:43
阅读次数:
273
原题地址:http://oj.leetcode.com/problems/binary-tree-level-order-traversal/题意:二叉树的层序遍历的实现。解题思路:二叉树的层序遍历可以用bfs或者dfs来实现。这里使用的dfs实现,代码比较简洁。实际上,二叉树的先序遍历就是dfs实...
分类:
编程语言 时间:
2014-05-14 03:25:59
阅读次数:
428
由于Android本身就是linux,为了避免各种不必要的坑,所以在linux下开发Android.当然不熟悉 linux 的,选择 windows
开发也是一样,没有任何问题,个人习惯就好.说一下我的开发环境, ubuntu 14.04(这个是最新的STL), JDK 1.7.0. 首先是 ...
分类:
移动开发 时间:
2014-05-14 01:59:42
阅读次数:
374
题目链接:点击打开链接
题意:给定n*m的矩阵
有一个人a从左上角↖走到右下角↘,只能↓或→走
另一个人b从左下角↙走到右上角↗,只能↑或→走
使得2个人的路径有且仅有一个格子是相交的。
统计2个人的权值和(相交格子的权值和不计)
问最大的权值和是多少。
思路:
首先转换一下题意,也就是找一个格子与4个角落连不相交的线。
我们观察相交的那个格子,那个格子的上下左右必然对应着一个角...
分类:
其他好文 时间:
2014-05-13 07:51:44
阅读次数:
280
手动模拟。。
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
#define N 10100
#define inf 1000000010
mapx,y;
struct X{
int x,y;
bool operator<(const X&a)const{...
分类:
其他好文 时间:
2014-05-13 07:29:10
阅读次数:
294
暴力出奇迹。。
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
#define ll __int64
#define N 42
ll n,m,ans;
ll Gcd(ll x,ll y){
if(x>y)swap(x,y);
while(x){
y%=...
分类:
其他好文 时间:
2014-05-12 23:11:06
阅读次数:
445
vector类为内置数组提供了一种替代表示,与string类一样 vector 类是随标准 C++引入的标准库的一部分 ,为了使用vector 我们必须包含相关的头文件 :
#include
使用vector有两种不同的形式,即所谓的数组习惯和 STL习惯。
一、数组习惯用法
1. 定义一个已知长度的 vector :
vector ivec( 10 ); //...
分类:
编程语言 时间:
2014-05-11 22:21:45
阅读次数:
415
链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=151
For each list of words, output a line with each word reversed without changing the order of the words.
This problem contains multi...
分类:
其他好文 时间:
2014-05-11 22:20:43
阅读次数:
443
C++ 11已将哈希表纳入了标准之列。hashtable是hash_set、hash_map、hash_multiset、hash_multimap的底层机制,即这四种容器中都包含一个hashtable。
解决碰撞问题的办法有许多,线性探测、二次探测、开链等等。SGI STL的hashtable采用的开链方法,每个hash table中的元素用vector承载,每个元素称为桶(bucke...
分类:
其他好文 时间:
2014-05-11 21:07:54
阅读次数:
522
链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=2724
Message queue is the basic fundamental of windows system. For each process, the system maintains a message queue. If something h...