会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
Rango_Zhang
博客园
首页
新随笔
联系
订阅
管理
2015年6月3日
LeetCode 2. add two numbers
摘要: 看似简单,轻易AD,但重点是和其他人写的代码进行比较从而学习C++:ListNode* addTwoNumbers(ListNode* l1, ListNode* l2) { ListNode* result; ListNode* cur; ListNode...
阅读全文
posted @ 2015-06-03 23:09 Rango_Zhang
阅读(196)
评论(0)
推荐(0)
2015年6月1日
LeetCode 1. twoSums
摘要: C++:vector twoSum(vector& nums, int target) { unordered_map hashMap; for (int i = 0; i {hashMap[nums[i]]+1, i+1}; } ...
阅读全文
posted @ 2015-06-01 23:12 Rango_Zhang
阅读(215)
评论(0)
推荐(0)
2015年4月30日
并发编程:c++11 多线程中随机数重复问题
摘要: srand(time(NULL));是我们熟悉的c++随机函数,用时间做种子。但由于在多线程环境下若想在子线程中随机出不同的随机数则需随机种子的不同。但time以秒计算,略显不足,故参考这篇文章解决此问题:/* 初始化随机种子 */void InitRand(){ // 如果支持高性能精度计...
阅读全文
posted @ 2015-04-30 14:16 Rango_Zhang
阅读(2394)
评论(0)
推荐(1)
并发编程: c++11 thread(Func, Args...)利用类成员函数创建线程
摘要: c++11是VS2012后支持的新标准,为并发编程提供了方便的std::thread。使用示例:#include void thread_func(int arg1, int arg2, float* arg3){ arg3 = (arg1*1.0)/(arg1 + arg2); cou...
阅读全文
posted @ 2015-04-30 14:05 Rango_Zhang
阅读(9812)
评论(0)
推荐(1)
公告