摘要: map的使用方法: 1 #include <cstdio> 2 #include <map> 3 #include <string> 4 using namespace std; 5 6 int main() 7 { 8 //声明int为键,const char* 为值 9 map<int,cons 阅读全文
posted @ 2016-03-06 16:30 Vmetrio 阅读(183) 评论(0) 推荐(0)
摘要: set是维护集合的容器 1 #include <cstdio> 2 #include <set> 3 using namespace std; 4 5 int main() 6 { 7 //声明 8 set<int> s; 9 10 //插入元素 11 s.insert(1); 12 s.inser 阅读全文
posted @ 2016-03-06 16:20 Vmetrio 阅读(135) 评论(0) 推荐(0)
摘要: 复杂度 O(logn) 1 #include <queue> 2 #include <cstdio> 3 using namespace std; 4 5 //表示节点的结构体 6 struct node{ 7 int val; 8 node *lch,*rch; 9 }; 10 11 //插入数值 阅读全文
posted @ 2016-03-06 16:04 Vmetrio 阅读(300) 评论(0) 推荐(0)
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2612 BFS搜索 目标地 并记录下来 之后再判断两段路程之和 代码: 1 #include <stdio.h> 2 #include <string.h> 3 #include <math.h> 4 # 阅读全文
posted @ 2016-03-06 15:44 Vmetrio 阅读(275) 评论(0) 推荐(0)
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1584 全部状态都判断一遍 代码: 1 #include <stdio.h> 2 #include <string.h> 3 #include <math.h> 4 #include <algorithm 阅读全文
posted @ 2016-03-06 14:48 Vmetrio 阅读(326) 评论(0) 推荐(0)