Say you have an array for which theithelement is the price of a given stock on dayi.Design an algorithm to find the maximum profit. You may complete a...
分类:
其他好文 时间:
2014-09-07 14:41:25
阅读次数:
240
c++11新增加了一些便利的算法,这些新增的算法使我们的代码写起来更简洁方便,这里仅仅列举一些常用的新增算法,算是做个总结,更多的新增算法读者可以参考http://en.cppreference.com/w/cpp/algorithm。 算法库新增了三个用于判断的算法all_of、any_of...
分类:
编程语言 时间:
2014-09-07 13:25:25
阅读次数:
207
Write an efficient algorithm that searches for a value in anmxnmatrix. This matrix has the following properties:Integers in each row are sorted from l...
分类:
其他好文 时间:
2014-09-07 10:58:14
阅读次数:
185
https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=4470
Go is a proverbial board game originated in China. It has been proved to be the most diffic...
分类:
其他好文 时间:
2014-09-06 21:21:53
阅读次数:
457
整合两道差不多的题目放上来,其中第一题是第二题的基础。
1.
Given a binary tree, determine if it is height-balanced.
For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two...
分类:
其他好文 时间:
2014-09-06 21:21:03
阅读次数:
279
一、前缀和(Prefix Sum)定义:
给定一个数组A[1..n],前缀和数组PrefixSum[1..n]定义为:PrefixSum[i] = A[0]+A[1]+...+A[i-1];
例如:A[5,6,7,8] --> PrefixSum[5,11,18,26]
PrefixSum[0] =A[0] ;
PrefixSum[1] =A[0] + A[1] ;
PrefixSum...
分类:
编程语言 时间:
2014-09-06 21:20:23
阅读次数:
897
题目来源:http://poj.org/problem?id=2236
Wireless Network
Time Limit: 10000MS
Memory Limit: 65536K
Total Submissions: 16470
Accepted: 6942
Description
An ea...
分类:
Web程序 时间:
2014-09-06 17:27:43
阅读次数:
264
题意:
有m个警察,派n个警察到n个银行,给出每个警察到各银行的时间,求最小的平均时间。
分析:
平均乘上n就是总时间,也就是要最小化总时间,那么用费用流就可以解决问题。各银行向每个警察连边,容量1,费用为时间;增加源点,源点向各银行连边,容量1,费用0;增加汇点,警察向汇点连边,容量1,费用0。在图中跑费用流就行。
这题最恶心的地方在于保留小数,结果加上eps再输出。这里涉及到保留小数方法,是用传统的四舍五入还是用银行家舍入?都不知道以后涉及到小数的输出要怎么搞了,这种东西就该spj啊。...
分类:
其他好文 时间:
2014-09-05 23:50:12
阅读次数:
282
A Sereja and Algorithm题意:给定有x,y,z组成的字符串,每次询问某一段s[l, r]能否变成变成zyxzyx的循环体。分析:分析每一段x,y,z数目是否满足构成循环体,当然长度 2 #define in freopen("solve_in.txt", "r", stdin);...
分类:
其他好文 时间:
2014-09-05 23:36:52
阅读次数:
351
看了 Andrew Ng 公开课里的第一节课后,感觉机器学习好高大上。。系里最高大上的国家级重点实验室CAD实验室用的3D成像技术就跟Andrew Ng大大放的聚类算法做出的3D场景几乎一样。看完后我觉得,我现在也开始走高端路线了→_→ 第一章:回归算法 1.LMS Algorithm(...
分类:
其他好文 时间:
2014-09-05 23:34:32
阅读次数:
227