题意:环形跑道上有N个加油站,编号为1~N。第 i 个加油站可以加油Ai加仑,从加油站 i 开到下一站需要Bi加仑汽油。问可作为起点走完一圈后回到起点的最小加油站编号。 解法:我们把每个加油站的Ai,Bi合并,把Ai-Bi看成N个点的权Ci,表示经过 i 的剩余油量。可知可通过第 i 个加油站就是s ...
分类:
编程语言 时间:
2016-11-01 13:42:34
阅读次数:
267
There was an epidemic in Monstropolis and all monsters became sick. To recover, all monsters lined up in queue for an appointment to the only doctor i ...
分类:
其他好文 时间:
2016-11-01 07:30:19
阅读次数:
457
Write the routines to do a "percolate up" and a "percolate down" in a binary min-heap. Format of functions: where int p is the position of the element ...
分类:
其他好文 时间:
2016-11-01 00:58:40
阅读次数:
204
top第一行:top--系统当前时间,up系统已运行时间,用户数,loadaverage系统负载(若此值超过CPU核数运行将会变慢)第二行:任务运行详细信息第三行:%Cpu,使用率第四行:内存使用情况第五行:交换内存使用情况第六行:命令行输入1,则会显示当前计算机的所有单CPU使用情况(..
分类:
其他好文 时间:
2016-10-31 22:30:18
阅读次数:
252
在8086CPU中,有一种标记寄存器,长度为16bit; 其中存储的信息被称为程序状态字(Program Status Word,PSW),以下将该寄存器简称为flag。 功能:1)用来存储相关指令的某些执行结果; 2)用来为CPU执行相关指令提供行为依据; 3)用来控制CPU的相关工作方式。 fl ...
分类:
编程语言 时间:
2016-10-31 21:48:36
阅读次数:
465
如何进行网站性能优化 雅虎Best Practices for Speeding Up Your Web Site: content方面 减少HTTP请求:合并文件、CSS精灵、inline Image 减少DNS查询:DNS查询完成之前浏览器不能从这个主机下载任何任何文件。方法:DNS缓存、将资源 ...
分类:
Web程序 时间:
2016-10-29 21:49:51
阅读次数:
209
Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum. F ...
分类:
编程语言 时间:
2016-10-29 19:20:50
阅读次数:
162
Computer Net Time limit: 2.0 secondMemory limit: 64 MB Background Computer net is created by consecutive computer plug-up to one that has already been ...
分类:
Web程序 时间:
2016-10-29 11:49:06
阅读次数:
208
Given an integer matrix, find the length of the longest increasing path. From each cell, you can either move to four directions: left, right, up or do ...
分类:
其他好文 时间:
2016-10-29 07:51:49
阅读次数:
226