摘要: HashMap<String, String> map = new HashMap<String, String>(); map.put("1", "2"); System.out.println(map.get("1")); 常用函数: containsKey(key) put(key, valu 阅读全文
posted @ 2016-01-23 03:51 飞飞喵 阅读(230) 评论(0) 推荐(0)
摘要: java.lang.Math APIhttps://docs.oracle.com/javase/7/docs/api/java/lang/Math.htmle.g. Math.max(a, b) 常用的有abs(a)ceil(a) floor(a) round(a) // 取整exp(a) // ... 阅读全文
posted @ 2016-01-23 02:47 飞飞喵 阅读(173) 评论(0) 推荐(0)
摘要: // ArrayListArrayList myArr = new ArrayList();myArr.add("one");myArr.add("two");System.out.println(myArr.get(0));//Vector Vector myV = new Vector ();... 阅读全文
posted @ 2016-01-22 12:41 飞飞喵 阅读(627) 评论(1) 推荐(0)
摘要: lower_bound 返回大于等于 upper_bound 返回大于 综合一下(按照默认集合升序排序的情况下),lower_bound、upper_bound函数不管在什么情况下,以下条件均成立。 Iterator(val) ≤ Iterator(lower_bound)≤Iterator(upp 阅读全文
posted @ 2016-01-16 10:03 飞飞喵 阅读(360) 评论(0) 推荐(0)
摘要: 根据空格splitstring str = "abc def,ghi";stringstream ss(str);string token;while (ss >> token) cout result;string tmp;string toBeSplited;stringstream ss... 阅读全文
posted @ 2016-01-10 01:32 飞飞喵 阅读(133) 评论(0) 推荐(0)
摘要: 从右起第一个为1的bit: a &-a; example: a = 4 //1100 -a= -4 //0011+1 = 0100 a&-a = 0100 ----------------------- ------------------------ 作用于bit的逻辑运算符: & // and 阅读全文
posted @ 2016-01-09 10:29 飞飞喵 阅读(196) 评论(0) 推荐(0)
摘要: stack mystack; //createmystack.push(1); mystack.pop(); // no return valuemystack.size();mystack.empty(); //trueif theunderlying container's size is0... 阅读全文
posted @ 2016-01-09 04:55 飞飞喵 阅读(123) 评论(1) 推荐(0)
摘要: C++ * 要写分号! * min/max函数只能比较两个数。 min(a,b,c) 会出错,要用 min(a,min(b,c)) * min/max的输入不能一个是sizetype, 一个是int * void move(stack<int> &s1, stack<int> &s2) 不加引用时是 阅读全文
posted @ 2016-01-09 03:03 飞飞喵 阅读(153) 评论(1) 推荐(0)
摘要: priority_queue优先队列容器与队列一样,只能从队尾添加(插入)元素,从队头(队首)删除元素。但他有一个特性,就是队列中最大的元素总是位于队首,所以出队时,并非按先进先出的原则进行,而是将当前队列中最大的元素出队。如果要删除中间元素,就要用heap 阅读全文
posted @ 2016-01-06 23:44 飞飞喵 阅读(130) 评论(0) 推荐(0)
摘要: // make_pair example#include // std::pair#include // std::coutint main () { std::pair foo; std::pair bar; foo = std::make_pair (10,20)... 阅读全文
posted @ 2016-01-06 23:28 飞飞喵 阅读(170) 评论(0) 推荐(0)