码迷,mamicode.com
首页 >  
搜索关键字:max    ( 23629个结果
python生成器
yield_atom::="("yield_expression")"yield_expression::="yield"[expression_list]在Python中带有yield的函数被称之为generator(生成器),简单地讲,yield的作用就是把一个函数变成一个generator。我们用生成斐波那契数列说明:>>>deffab(max): n,a,b=0,0,1 while..
分类:编程语言   时间:2014-08-04 18:16:48    阅读次数:243
poj1236 Network of Schools ,求强连通分量(Tarjan算法),缩点
题目链接: 点击打开链接 题意:  给定一个有向图,求: 1) 至少要选几个顶点,才能做到从这些顶点出发,可以到达全部顶点 2) 至少要加多少条边,才能使得从任何一个顶点出发,都能到达全部顶点     顶点数 求完强连通分量后,缩点,计算每个点的入度,出度。  第一问的答案就是入度为零的点的个数,  第二问就是max(n,m) // 入度为零的个数为n, 出度为...
分类:Web程序   时间:2014-08-04 18:05:17    阅读次数:290
hdu 4907 Task schedule(二分)
# include # include # include using namespace std; int vis[200010]; int b[200100]; # define Max 200010 int main() { int t,T,n,m,a,i; while(~scanf("%d",&T)) { while(T--) { scanf("%d%d",&n,...
分类:其他好文   时间:2014-08-04 18:04:47    阅读次数:258
HDU 1003 Max Sum 最大连续子序列的和
Problem Description Given a sequence a[1],a[2],a[3]......a[n], your job is to calculate the max sum of a sub-sequence. For example, given (6,-1,5,4,-7), the max sum in this sequence is 6 + (-1) + 5 +...
分类:其他好文   时间:2014-08-04 17:52:47    阅读次数:187
POJ 3630 Phone List Trie题解
Trie的应用题目。 本题有两个难点了: 1 动态建立Trie会超时,需要静态建立数组,然后构造树 2 判断的时候注意两种情况: 1) Tire树有133,然后插入13333556的时候,2)插入顺序倒转过来的时候 修改一下标准Trie数的插入函数就可以了: #include #include const int MAX_NODE = 100001; const int M...
分类:其他好文   时间:2014-08-04 17:44:47    阅读次数:213
2.任意输入三个数,求最大数
(1)笨办法,采用if嵌套和&&判断,比较消耗资源,不过也能达到要求:#includeusing namespace std;int main(){ int a,b,c,max; cout>a>>b>>c; if(a>b&&a>c) max=a; else if(b>c&&b>a...
分类:其他好文   时间:2014-08-04 17:09:27    阅读次数:238
hdoj 4907 Task schedule 【预处理】
题意:中文题,你懂得。。。 思路:建两个数组,一个标记,一个放答案(就是最快能处理的任务点), 在输入数据的时候标记改位置已经有任务了,并且找出来一个最大的数max。然后从max+1,出发从大到小,依次用temp定义没有任务的序号,如果是没有被标记那么就将该处的答案定义为temp。 题目链接 点击打开链接 代码: #include #include #define MAXN 200005 ...
分类:其他好文   时间:2014-08-04 14:32:57    阅读次数:187
使用红黑树查找最小n个数,适合处理大数据
使用STL容器 multiset 代码: #include #include #include using namespace std; typedef multiset > intSet; typedef multiset >::iterator intIter; void findMaxNum(const vector &data,int k){ intSet Max; ...
分类:其他好文   时间:2014-08-04 14:20:17    阅读次数:197
HDU 1823 二维线段树(区间max)
Luck and LoveTime Limit: 10000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 5262Accepted Submission(s): 1317Prob...
分类:其他好文   时间:2014-08-04 14:10:27    阅读次数:341
pog.org 2488
/** POJ 2488* DFS进行遍历就好,记录走过的路径,只要不重复地走过p*q个方格就行了(结束条件) */#include #include #include using namespace std;const int Max = 30; int kase;int p,q;int vis[...
分类:其他好文   时间:2014-08-04 14:00:37    阅读次数:175
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!