Imagine a (literal) stack of plates. If the stack gets too high, it might topple. Therefore, in real life, we would likely start a new stack when the ...
分类:
其他好文 时间:
2014-07-16 23:07:09
阅读次数:
196
Imagine a (literal) stack of plates. If the stack gets too high, it might topple. Therefore, in real life, we would likely start a new stack when the ...
分类:
其他好文 时间:
2014-07-12 08:24:00
阅读次数:
258
Imagine a (literal) stack of plates. If the stack gets too high, it might topple. Therefore, in real life, we would likely start a new stack when the ...
分类:
其他好文 时间:
2014-07-12 08:23:16
阅读次数:
231
Imagine a (literal) stack of plates. If the stack gets too high, it might topple. Therefore, in real life, we would likely start a new stack when the ...
分类:
其他好文 时间:
2014-07-12 08:22:39
阅读次数:
181
我都不好意思在标题上写这是最短路
这题挺有意思,关键在于把题目所求的量转换为最短路问题。
题意:
给一个无向图,每个结点有权值p[i],每条边有权值w[i]
求使这颗树所有顶点与根节点1联通的最小花费,
最小花费=∑w[i]×∑p[i]
第一个∑是所有边,第二个∑是该边下所有结点的权值和
思路:
通过推导可以发现,对于每个结点,它被算入的花费为 p[i]*d[i],...
分类:
其他好文 时间:
2014-07-10 20:18:43
阅读次数:
177
You can Solve a Geometry Problem too
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 6997 Accepted Submission(s): 3385
Problem Desc...
分类:
其他好文 时间:
2014-07-10 19:30:48
阅读次数:
256
经验:尽可能延后变量定义式的出现。这样做可增加程序的清晰度并改善程序效率。
示例:
//这个函数过早定义变量“encrypted”
std::string encryptPassword(const std::string &password){
using namespace std;
string encrypted;
if(password.length() < MinimumPasswordLength){
throw logic_error("Password is too short"...
分类:
编程语言 时间:
2014-07-10 19:27:30
阅读次数:
253
重复、先学会用它、不断向自己问问题(写博客)、自己做产品!
1.对于较艰深的技术,如内核和算法,重复看,硬着头皮看,找到该技术top3的书反复研读,会有所悟的。
2.linus torwards大神如是说:想精通Linux,先学会用它!搭个系统使用它,再写小程序练习验证。
3.问问题,big view and small detail,反复缩放,直到问到的问题足够具体,你就理解了。写...
分类:
其他好文 时间:
2014-07-10 17:21:50
阅读次数:
225
在工作中,大家或许常常遇到Too many connections这个错误,这时作为DBA想进数据库管理都进不去,是非常尴尬的一件事情。当然有同学说可以修改配置文件,但是修改配置文件是需要重启mysqld的,这在业务繁忙的数据库服务器上是不允许的。所以紧急情况下可以采用如下的方法,比如下面的测试。[...
分类:
其他好文 时间:
2014-07-10 16:49:29
阅读次数:
302
说明:以下内容参考了抚琴煮酒的《构建高可用Linux服务器》第六章内容.搭建负载均衡高可用环境相对简单,主要是要理解其中原理。此文描述了三种负载均衡器的优缺点,以便在实际的生产应用中,按需求取舍。目前,在线上环境中应用较多的负载均衡器硬件有F5 BIG-IP,软件有LVS,Nginx及HAProxy...
分类:
其他好文 时间:
2014-07-10 15:57:24
阅读次数:
238