#include#include#include#includeusing namespace std;struct p{int a,b;};bool cmp(p p1, p p2){if(p1.b>p2.b) return true;if(p1.b==p2.b && p1.a>m;while(m-...
分类:
其他好文 时间:
2014-08-15 12:47:48
阅读次数:
281
Given an index k, return the kth row of the Pascal's triangle.For example, given k = 3,Return [1,3,3,1].Note:Could you optimize your algorithm to use ...
分类:
其他好文 时间:
2014-08-14 23:44:26
阅读次数:
323
Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complet...
分类:
其他好文 时间:
2014-08-14 23:19:46
阅读次数:
240
Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complet...
分类:
其他好文 时间:
2014-08-14 23:05:56
阅读次数:
165
public static void main(String[] args) { String subjectDN = "CN=duwenlei"; String algorithm = ""; try { KeyPairGenerat...
分类:
其他好文 时间:
2014-08-14 20:12:39
阅读次数:
175
分析问题 标准模版库(STL)实在惠普实验室开发出来的一套算法类库的集合,从概念上主要区分为三大部分: 1、算法(algorithm)。 2、容器(container)。 3、迭代器(iterrator)。 STL的设计都致力于打造通用的算法和类库,例如一个排序的算法,可能针对包含不同类型...
分类:
Web程序 时间:
2014-08-14 10:21:38
阅读次数:
262
题目大意是,给定N个顶点,M条边,两个顶点之间可能有多条边,求至少删除多少条边才能将该图分成两个子图。
最小割集,典型的算法Stoer-Wagner,就是那篇论文,这里也就不复制过来了,只是用Prim求最大生成树时,更新的“边”不是普通意义上的边,而是顶点到所有已划分集合中的所有点的边权值和,这里要特别注意~ 直接贴代码~
#include
#include
#includ...
分类:
其他好文 时间:
2014-08-13 22:33:07
阅读次数:
287
杨辉三角的多种解法
杨辉三角的相信大家很熟悉吧,但是大家能用多少中方法写出来呀,一般人都只会想到两种,递归和二项式。当用递推时,有时在解题是根本没必要需要那么多呀,而只要杨辉三角的某一行,数据小时,我们可以用二项式来计算,但是数据比较大时,二项式算也是很麻烦的,那么还有其它的方法吗?所以下面我就介绍几种计算杨辉三角的方法吧。
主要要记住第四种。。。。
完整版下载:http://downl...
分类:
其他好文 时间:
2014-08-13 22:32:37
阅读次数:
316
很水,但是需要练速度反映。。。15分钟全部写对!!!!!!!!!!!!
#include
#include
#include
using namespace std;
class Decimal {
public:
int integer;
bool recycle;
vector decimal;
};
void toDecimal(int dividend, ...
分类:
其他好文 时间:
2014-08-13 22:28:47
阅读次数:
277
algorithm 简单用法#include #include #include using namespace std;int student_Score[] = { 50,80,93,23,66};void pritit(int nScore){ cout= 60;}int main(int a...
分类:
其他好文 时间:
2014-08-13 14:22:36
阅读次数:
157