- 博客(8)
- 收藏
- 关注
原创 LeetCode 452 射气球问题
There are a number of spherical balloons spread in two-dimensional space. For each balloon, provided input is the start and end coordinates of the horizontal diameter. Since it’s horizontal, y-coordina
2017-10-30 19:37:03 893
原创 ubuntu16.04优麒麟配置
电脑坏了需要重新安装linux虚拟机,但是上次配置没记录下来,又需要查很多资料,这次就一劳永逸吧。首先,改变文件更新源的地址,不然下载速度可能会很慢 systemsetting中 或者sudo gedit /etc/apt/sources.list然后添加以下内容之一:#阿里源(此行不复制) deb http://mirrors.aliyun.com/ubuntu/ xenial main
2017-09-14 13:43:48 4033
转载 有用的性能指标
转载自:http://surana.wordpress.com/2009/01/01/numbers-everyone-should-know/L1 cache reference 0.5 ns Branch mispredict 5 ns L2 cache reference 7 ns Mutex lock/unlock 100 ns Main memory reference 100 n
2017-09-02 13:45:07 341
原创 阿里巴巴2017测试题--抽奖
题目描述有1到7编号的7个球,连续抽取3个球,其中有2个球连续,则中奖,求中奖的概率。思路首先从7个球中抽取3个球有A37A^{3}_{7} =35种可能。然后把1、2两个球看成一个整体,则中奖可能有5种。再把2、3两个球看成一个整体,则总共有4种。 然后把3、4看成一个整体,则有可能另一个号码小于3-1,大于4,则总共有4种。 4、5看成整体,则另一个号码小于3,大于5,有4种。 5、6看
2017-08-22 00:18:13 469
原创 剑指OFFER--二进制中1的个数
题目描述输入一个整数,输出该数二进制表示中1的个数。其中负数用补码表示。int NumverOf1(int n){ int count=0; while(n) { ++count; n=(n-1)&n; } return count;}分析我们会发现每次n&(n-1)都会把n中的一个1变成0;然后count++;所以循环结束
2017-08-16 17:56:07 191
原创 C++11单例模式
#include <iostream>#include <windows.h>#include<thread>using namespace std;class sig{private: sig() { cout << "构造函数start" << endl; Sleep(1000); cout << "构造函数end";
2017-08-16 17:35:00 240
原创 循环链表实现约瑟夫问题
#include <iostream>using namespace std;struct joseph{ int i; joseph *next;}*rear;void joseph_math(int n, int k);int main(){ int n,k; cin >> n >> k; joseph_math(n, k); retu
2017-04-04 23:08:10 210
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人