现在位置: 首页 > threading发表的所有文章
  • 04月
  • 26日
综合 ⁄ 共 1230字 评论关闭
设计包含min函数的栈。定义栈的数据结构,要求添加一个min函数,能够得到栈的最小元素。 要求函数min、push以及pop的时间复杂度都是O(1)。 结合链表一起做。容器vector代替链表 eg:  10,3,3,8,2,6 1.push()   :如果push入栈A的元素小于栈B的栈顶所对应的的元素,则将该元素push入栈B中; 或者第一个元素也直接push入B中 栈A     辅助栈B( 存放最小值 ) 6            2 min=2         2            2 min=2           8            3 min=3           3            3                       min=3            3         ......
阅读全文
  • 10月
  • 16日
综合 ⁄ 共 1084字 评论关闭
1. 简介            constvar是一个简单的开源DIRECTUI界面框架,最开始是为WINCE平台的触摸屏设备上的应用设计,所以它尤其适合WINCE或WINDOWS 触摸屏设备上的界面开发。 constvar的开发目的就是让应用界面的开发和维护变得简单,同时又保持自身极其精简。各种简单是它最核心的特点及开发目标。它不具备跨平台、跨语言、及其它繁杂的功能。如果是其它平台或语言要用的话,就需要读者自己去移植了,但绝大部分主要代码都是可以使用或参考的。 2.Constvar的几大特性 Constvar适应需求变换能力超强,并且开发极其简单安全:  2.1 开......
阅读全文
  • 09月
  • 29日
综合 ⁄ 共 958字 评论关闭
什么是单例模式? 单例模式(Singleton),保证一个类仅有一个实例,并提供一个访问它的全局访问点。通常我们可以让一个全局变量使得一个对象被访问,但它不能防止你实例化多个对象,一个 最好的办法是,让类自身负责保存它的唯一实例。这个类可以保证没有其它实例可以被创建,并且它可以提供一个访问该实例的方法。 单例模式解决了什么问题? 1.全局访问:外界不能通过new来实例化该变量,但是我们又要提供一个方法使得外界可以得到该实例; 2.实例化控制:实例化仅由该类自己控制,而不需要调用这个类的那部分控制; 简单来说就......
阅读全文
  • 07月
  • 14日
综合 ⁄ 共 790字 评论关闭
用C++处理数据,想用图表的形式展现出来。发现微软有一个叫做MSChart的控件,但是网上找到的都是在C#中怎么使用,以及VC6.0中的MFC里添加MSChart.   1、安装。    依次装上dotnetfx35setup.exe,MSChart.exe,MSChart_VisualStudioAddOn.exe。 2、去网上下一个mschrt20.ocx,放在C:/WINDOWS/system32目录下。命令行运行regsvr32 mschrt20.ocx。 3、建一个MFC的工程,在设计界面右击->插入ActiveX控件->选Microsoft Chart Control, version 6.0 (OLEDB). 4、控件添加好以后,右击控件->添加类,类名MSChart,于是生......
阅读全文
  • 06月
  • 08日
综合 ⁄ 共 3879字 评论关闭
  VRRP                 -- Jin 2011.06.01    # Background     The Virtual Router Redundancy Protocol (VRRP) is designed to eliminate the single point of failure inherent in the static default routed environment.  VRRP specifies an election protocol that dynamically assigns responsibility for a virtual router to one of the VRRP routers on a LAN.   All routers(gateways) that are running VRRP protocol act as one vitural router(gateway).    So, there are master and backup, only master acts as ......
阅读全文
  • 05月
  • 17日
综合 ⁄ 共 964字 评论关闭
// --------------------- .h --------------------- // 用于校准位置 void xSprite(CCNode* in_pNode, CCPoint in_oPntPosi, CCPoint in_oPntAnc = ccp(0.5f, 0.5f)); // 用于可视化节点包围框 void xLayerColor(CCNode* in_pNode); // --------------------- .cpp --------------------- // 用于校准位置 void xSprite(CCNode* in_pNode, CCPoint in_oPntPosi, CCPoint in_oPntAnc) { CCSprite* t_pSprite = CCSprite::create("dot.png"); t_pSprite->setAnchorPoint(in_oPntAnc); t_pSprite->setPositio......
阅读全文
  • 05月
  • 16日
综合 ⁄ 共 1941字 评论关闭
1. final修饰类: final修饰类即表示此类已经是“最后的、最终的”含义。因此,用final修饰的类不能被继承,即不能拥有自己的子类。 如果视图对一个已经用final修饰的类进行继承,在编译期间或发生错误。   2. final修饰方法: final修饰的方法表示此方法已经是“最后的、最终的”含义,亦即此方法不能被重写(可以重载多个final修饰的方法)。 此处需要注意的一点是:因为重写的前提是子类可以从父类中继承此方法,如果父类中final修饰的方法同时访问控制权限为private, 将会导致子类中不能直接继承到此方法,因此,此时可以......
阅读全文
  • 04月
  • 29日
综合 ⁄ 共 1457字 评论关闭
1003:Hangover 时间限制:  1000ms  内存限制:  65536kB 描述 How far can you make a stack of cards overhang a table? If you have one card, you can create a maximum overhang of half a card length. (We're assuming that the cards must be perpendicular to the table.) With two cards you can make the top card overhang the bottom one by half a card length, and the bottom one overhang the table by a third of a card length, for a total maximum overhang of 1/2 + 1/3 = 5/6 card lengths. In......
阅读全文
  • 04月
  • 29日
综合 ⁄ 共 901字 评论关闭
对于KMP算法中next函数的应用 题意是对于一个字符串的前缀和后缀比较是否相等,再把相等的可能按字符串长度进行输出 #include <iostream> #include<stdio.h> #include<string.h> using namespace std; int len; int next[1000005]; char s[1000005]; int kmp_next() {     int i=0,j=-1;     next[0]=-1;     while(i<len)     {         if(j==-1||s[i]==s[j])         {             i++;j++;             next[i]=j;         }         else             j=next[j];     }      //for(int i=0;i<len;i......
阅读全文
  • 04月
  • 28日
综合 ⁄ 共 741字 评论关闭
1.安装git: apt-get install git 2.添加信息 git config --global user.name"xxxxx" git config --global user.email xxxxx@xxx.com 3.生成sshkey ssh-keygen -t rsa -C "your_email@example.com" 4.将~/.ssh/id_rsa.pub的内容添加到GitHub的sshKey中 5.测试 ssh -T git@github.com 6.在需要的目录下新建仓库 git init 7.在GitHub上建立一个远程仓库,得到ssh url 8.建立连接 git remote add origin git@github.com:XXXX/xxxxx.git(后面的地址即为上一步得到的ssh url) 9.添加文件到git git add .(后面有个小数点,表示添加当......
阅读全文
  • 04月
  • 24日
综合 ⁄ 共 1922字 评论关闭
time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output One way to create a task is to learn from life. You can choose some experience in real life, formalize it and then you will get a new task. Let's think about a scene in real life: there are lots of people waiting in front of the elevator, each person wants to go to a certain floor. We can formalize it in the following way. We have n people standing on the first floor,......
阅读全文
  • 04月
  • 22日
综合 ⁄ 共 5984字 评论关闭
 在嵌入式系统内,对图像进行实时匹配,这项任务给特征点的检测与描述提出了更高的要求。这不仅要求运算速度快,而且还要求占用更少的内存。 SIFT和SURF方法性能优异,但它们在实时应用中就力不从心,一个主要的原因就是特征点的描述符结构较复杂,表现形式是第一描述符的维数较多,第二描述符采用浮点型的数据格式。维数多固然可以提高特征点的可区分性,但使描述符的生成和特征点的匹配的效率降低,另一方面采用浮点型的数据格式也必然增加了更大的内存开销。因此改进描述符的形式就成为提高特征点匹配的一个重要手段。 目......
阅读全文