算法
hellobin · 共 80 篇文章
1. Two Sum
1. Two Sum Easy 17485626Add to ListShare Given an array of integers nums and an integer target , return indices of the two numbers such that they add up to target . You may assume that each input would have exactly one solution, and you may not use the same element twice. You can return the answer …
2020-10-25 08:25 · Leetcode · 评论(0)
如何提高免疫力?
专家认为以下几方面值得重视: 日常起居 睡眠好 加拿大多伦多睡眠及生理节奏学中心、睡眠失调症诊治所的研究说,人进入睡眠状态后,各种有益于增强免疫功能的作用过程便随即开始。如果每日睡眠少于7至8小时,患病的几率就可能增加。因为长期睡眠不足会给机体造成损害,包括思考能力减退、警觉力和判断力下降、免疫功能低下。 交朋友 国外有研究显示,良好的社交和融洽的同事友情能降低感染伤风感冒的发生几率,而且能够有助于激活自然杀伤细胞的活力,这些细胞专门“捕捉”和“破坏”肿瘤细胞以及已经被病毒侵入的细胞,因而有利于抗肿瘤、抗病毒感染和增强免疫调节。和朋友聊天,或倾诉心事可以令人心情愉快,使身体减少分泌一种会对免…
2013-07-13 18:21 · 评论(0)
Qt Ubuntu 12.10 error ptrace: Operation not permitted
While trying to debug for the first time I got this error: ptrace: Operation not permitted. Could not attach to the process. Make sure no other debugger traces this process. Check the settings of /proc/sys/kernel/yama/ptrace_scope For more details, see /etc/sysctl.d/10-ptrace.conf Solution: On Ubun…
2013-07-04 11:30 · 评论(0)
emacs+gdb
$ emacs helloworld.c # 打开文件 C+x 3 # 水平切窗口 M+x gdb # 直接gdb M+x shel #进入shell M+x compile #编译模式 C+x C+c #退出emacs 其中C是ctrl,M是Alt http://tedlab.mit.edu/~dr/gdbintro.html
2013-07-04 00:25 · 评论(0)
Ubuntu 12.04 64bit libtermcap.so.2 no such file or directory
$ sudo updatedb $ locate libncurses you will see a set of libncurse.so. files for eg : /lib/libncurses.so.5 /lib/libncurses.so.5.7 etc If you do not see such files then you will have to install libncurses, which you can do using the synaptic package manager or $ sudo apt-get install libncurses5 (or…
2013-07-01 20:18 · 评论(0)
Ubuntu 12.04 64bit 无法安装ia32-libs 解决
错误信息: junior@mediacenter:~$ sudo apt-get install ia32-libs Reading package lists... Done Building dependency tree Reading state information... Done Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that …
2013-07-01 19:44 · 评论(0)
IEEE浮点数舍入(四舍六入五成双)
浮点数舍入相比向整数舍入,就复杂一些,IEEE定义了四种不同的舍入方式,默认的为向偶数舍入(round-to-even)。其他三个分别是向零舍入,向上舍入和向下舍入。 其他三个比较直观,就不再说明,以十进制为例说明“向偶数舍入”,平常的四舍五入中,以舍入到小数点后两位为例,如果第3位小数小于5,则舍去,大于等于5的则进1。向偶数舍入除了最中间的这个值(第3位小数为5)以外,其他与平常的舍入相同,中间的这个值,则要保证在舍入的时候舍入位必须为偶数。比如1.40, 1.60, 1.50, 2.50, -1.50向偶数舍入的结果分别为1, 2, 2, 2, -2 至于为什么要想偶数舍入,这是CSA…
2013-06-02 21:52 · 评论(0)
Win7 64位安装VS2010出现错误failed for component Microsoft Visual Studio 2010 64bit Prer
错误信息如下: Error: Installation failed for component Microsoft Visual Studio 2010 64bit Prerequisites (x64). MSI returned error code 1603 界面如下: 网上找了很多解决方案,都未能奏效,包括重启、删除.net framework 4.0 Client Profile、直接运行安装包里面的VS_Prerequisites_x64_enu.msi,都未能奏效,也有人说重装英文版win7可以解决,但这个我没有试过(汗)。 这里给出一个完整的解决办法(请做好备份) 我的安装…
2013-05-19 22:01 · 评论(0)
笔试题:如何判断单链表是否存在环
给定一个单链表,只给出头指针h: 1、如何判断是否存在环? 2、如何知道环的长度? 3、如何找出环的连接点在哪里? 4、带环链表的长度是多少? 解法: 1、对于问题1,使用追赶的方法,设定两个指针slow、fast,从头指针开始,每次分别前进1步、2步。如存在环,则两者相遇;如不存在环,fast遇到NULL退出。 2、对于问题2,记录下问题1的碰撞点p,slow、fast从该点开始,再次碰撞所走过的操作数就是环的长度s。 3、问题3:有定理:碰撞点p到连接点的距离=头指针到连接点的距离,因此,分别从碰撞点、头指针开始走,相遇的那个点就是连接点。 该定理的证明可参考: http://fayaa…
2013-05-16 15:25 · Interview · 评论(0)
64位win7使用debug的方法
32位的Win7同志就不用看了 直接搜索C盘 debug就找到了 XP也一样 主要说一下64位Win7使用debug程序的方法 首先你要下载一个DOSBOX程序 这个程序是一个dos模拟器 这个程序的制作目的是运行经典的DOS游戏 -。- 下载地址: http://www.dosbox.com/download.php?main=1 其次下载一个Win732位的debug程序 下载地址: http://ishare.iask.sina.com.cn/f/22742021.html%20onclick= 下载windows版本的DOSBOX程序安装 弹出的信息选择下载文件: 安装的过程我就不写…
2013-05-08 04:59 · 评论(0)
POJ 2663 Tri Tiling
Description In how many ways can you tile a 3xn rectangle with 2x1 dominoes? Here is a sample tiling of a 3x12 rectangle. Input Input consists of several test cases followed by a line containing -1. Each test case is a line containing an integer 0 <= n <= 30. Output For each test case, output one i…
2013-05-02 17:54 · Online Judge · 评论(0)
Debug NDK so library
1) Declare your application as "debuggable" in your Android Manifest. In Eclipse, you can do this from the Application tab when viewing the Manifest (on the right side, set Debuggable to true). Otherwise, in the AndroidManifest.xml file, add android:debuggable="true" to the <application> element. 2…
2013-04-26 19:23 · 评论(0)
Android HttpURLConnection 与 HttpDefaultClient
HttpURLConnection 在java里面会发生能用,然而在Android里却不能用的情况! private class MyAuthenticator extends Authenticator { private String user = null; private String passwd = null; public MyAuthenticator(String user, String passwd) { this.user = user; this.passwd = passwd; } @Override public PasswordAuthentication g…
2013-04-18 19:50 · Android · 评论(0)
食管癌的病因和预防
食管癌的病因和预防 食管癌,谷称噎食病或嗝食病,是食管粘膜上皮及食管腺上皮发生的恶性肿瘤。多见于男性,病人中男与女之比为1.6:1。40岁以上多见,发病的高峰在50~70岁间,这个年龄组的病人占整个食管癌病便的60%。 食管癌是我国很多地区常见的恶性肿瘤之一。根据河南、河北、山西、四川、广东及安徽等省476个市、县的食管癌死亡回顾调查,可以看出,食管癌的地理分布有一定的规律性,即每省都有一个食管癌死亡率明显高于周围地区的“高发中心”。这个中心在华北三省主要集中在太行山南段三省交界地带;在川西北主要集中在盐亭、阆中及南部三县交界地带;在广东,其高发中心位于南澳岛,在安徽则以枞阳、桐城、庐江为高…
2013-04-10 23:42 · Healthy Life · 评论(0)