码迷,mamicode.com
首页 >  
搜索关键字:algorithm    ( 11758个结果)
Algorithm Part I:Programming Assignment(3)
问题描述: Programming Assignment 3: Pattern Recognition Write a program to recognize line patterns in a given set of points. Computer vision involves analyzing patterns in visual images and recon...
分类:其他好文   时间:2014-09-28 17:10:03    阅读次数:293
leetcode - Swap Nodes in Pairs
Given a linked list, swap every two adjacent nodes and return its head. For example, Given 1->2->3->4, you should return the list as 2->1->4->3. Your algorithm should use only constant space. Y...
分类:其他好文   时间:2014-09-28 14:33:56    阅读次数:178
hdu 2521 一卡通大冒险 (斯特灵数,贝尔数)
/* 将N张卡分成若干个集合,集合不为空,有多少种分法。 f[n][m]表示n张卡分成m组的种类数,那么f[n][m]=f[n-1][m-1]+f[n-1][m]*m,//第二类斯特灵数 而ans[n]=sum{f[n][l]}(1<=l<=m)。//ans为贝尔数,Bell数是将P个元素集合分到非空且不可区分例子的划分个数。 其中:f[n-1][m-1]代表第n个人自成一堆; f[n-1][m]...
分类:其他好文   时间:2014-09-28 00:45:10    阅读次数:186
point in polygon algorithm
Point-In-Polygon Algorithm — Determining Whether A Point Is Inside A Complex Polygon© 1998,2006,2007 Darel Rex Finley. This complete article, unmodifi...
分类:其他好文   时间:2014-09-27 21:34:40    阅读次数:290
Single Number II
题目描述:Given an array of integers, every element appearsthreetimes except for one. Find that single one.Note:Your algorithm should have a linear runtime...
分类:其他好文   时间:2014-09-27 18:53:40    阅读次数:204
poj 2456 Aggressive cows
题目链接:http://poj.org/problem?id=2456 题目大意:给你n个坐标,求c个坐标中最小的最大距离。 思路:这题跟poj3273有点是差不多的方法,不过要先把坐标排序,然后用在最短距离跟最大距离之间进行查找,每次二分判断最小距离为mid的个数 code: #include #include #include #include #include using ...
分类:其他好文   时间:2014-09-27 00:01:58    阅读次数:300
poj 3273 Monthly Expense
题目链接:http://poj.org/problem?id=3273 题目大意:给你n个数把他们连续的分成m组,问最小的那一组的最大值。 思路:用最小的那一个元素和总和进行二分。。。然后判断最小那组为mid时,分组的个数。 #include #include #include #include #include using namespace std; int a[1...
分类:其他好文   时间:2014-09-26 23:13:28    阅读次数:358
HDU 3037 Saving Beans (Lucas定理)
/*求在n棵树上摘不超过m颗豆子的方案,结果对p取模。 求C(n+m,m)%p。 因为n,m很大,这里可以直接套用Lucas定理的模板即可。 Lucas(n,m,p)=C(n%p,m%p,p)*Lucas(n/p,m/p,p); ///这里可以采用对n分段递归求解, Lucas(x,0,p)=1; 将n,m分解变小之后问题又转换成了求C(a/b)%p。 而C(a,b) =a! / ( b! *...
分类:其他好文   时间:2014-09-26 22:58:09    阅读次数:176
LA3942 Remember the Word(Trie+DP)
Trie图的简单应用。这题关键是想出递推式。令d(i)表示从字符i开始的字符串,d(i)=sum{d(i+len(x))},x是s[i...L]的前缀。然后把所有可分解成的单词构造成一颗Trie树,再让母串在上面跑,d[0]即是方案总数。 #include #include #include #include #define mod 20071027 #define M 400005 using...
分类:其他好文   时间:2014-09-26 20:24:47    阅读次数:179
Halloween party
Halloweenparty#include<cmath> #include<cstdio> #include<vector> #include<iostream> #include<algorithm> usingnamespacestd; intmain(){ intT; unsignedlongK; cin>>T; while(T>=1&&T<=10&&T--) { cin>&..
分类:其他好文   时间:2014-09-26 20:05:09    阅读次数:122
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!