15. 3Sum Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero. Note: The solution set must not contain duplicate triplets. For example, given array…
18. 4Sum Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of target. Note For example, given array S = [1, 0, -1, 0, -2, 2], and targ…
16.3Sum Closest Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each input would have exactly one solution. For example, given…
2016 10 28 考试 时间 7:50 AM to 11:15 AM 下载链接: 试题 考试包 这次考试对自己的表现非常不满意!! T1看出来是dp题目,但是在考试过程中并没有推出转移方程,考虑了打表,但是发现暴力程序的速度不够,直接交了暴力,没想到暴力程序爆0,考试后仔细查找发现是在深搜过程中的一个剪枝处忘记调整全局变量的值,,,低级错误要引以为戒!! for (int i = 0; i <= cur; i++) { a[x] += i; if (a[x] < a[x-1]) { a[x…
未经许可谢绝以任何形式对本文内容进行转载! 在文章开头不得不说的是,因为这部分的代码需要仔细理清的东西太多,所以导致这篇分析显得很啰嗦,还请谅解. 我们在上一篇文章已经分析了Boot Loader的功能,现在我们来分析由Boot Loader加载到内存里的kernel.从MAKEFILE文件可以看出kernel由以下几部分代码组成(注:这里给出的列表是进行lab2时的代码,即比lab1多了pmap.c等文件,由lab1更新到lab2需要用到Git,具体操作仅贴出参考链接:http://www.x…
在发展过程中,经常会遇到利用上课时间.说话的Date类就不得不提时间戳,左右fr=aladdin" target="_blank">的定义大家能够看看网上对时间戳的定义.我今天仅仅介绍一下Date类和时间戳直接的转换:以下我把自己做的两个小Demo贴出来或许对刚接触java的朋友会有帮助,也是我学习过程中的一点总结.假设有什么不足之处希望各位大神多多不吝赐教.! import java.util.*; import java.text.SimpleDateFormat;…
调用free api做做简易的翻译 这个是百度翻译api文档 http://api.fanyi.baidu.com/api/trans/product/apidoc 照着百度api给的文档向web服务器发送GET/POST请求,得到需要的翻译json格式,再进行解析即可. 但是貌似只能单词翻译,而且还会出现无法翻译“me”或者“he”的bug,果然百度翻译靠不住 下面上源码,一开始可以在官网上下载demo看看: 配置环境:python 3.x 即可 en_to_zh.py #!/usr/bin/…
很久没更博客了,索性开一个久未更 系列 > > > > > 久未更 系列一:关于ToolBar的使用(后续补充) //让 ToolBar 单独使用深色主题 使得 toolbar 中元素 变为淡色 android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" //去除 toolbar 默认 标题 getSupportActionBar().setDisplayShowTitleEnabled(fal…
2016.10.31 22:44 一个“程序”,打代码占40%.思考占60% 2016.10.30 20:53 周末,话说今天有晚上讲座,还点名,了,悲催.之前学习的Qt有点问题,悲催.推荐个博文:http://www.cnblogs.com/cutepig/p/5966811.html,看了会更悲催,看看自己有多渣渣...... 2016.10.28 22:35 周五,审核表用了两三个小时醉了,把Qt想简单了,推荐下Qt学习网址(豆子):http://blog.51cto.com/zt/20/…
2016.10.5初中部上午NOIP普及组比赛总结 这次的题目出得挺有质量的.但我觉得我更应该努力了. 进度: 比赛:0+20+0+0=20 改题:AC+AC+AC+AC=AK kk的作业 这题我错得--文件输入输出--别提了,听题! 题目简化: 上一行的数之积/下一行的数之积 不能用小数,用分数(记得化简). 接输出'0'+#13+'1' 暴力地把分子和分母分别乘起来. 然后除以它们的最大公因数(gcd) 也就是约分. 后来感觉会爆. 所以我后来又改了一种方法: 每次两边都分别给fz(分子)和…