
ACM水题之路—母函数
a342374071
这个作者很懒,什么都没留下…
展开
-
HDU 2152 Fruit 母函数
<br />最基础的母函数,0ms秒过。<br />直接模版过掉。<br />#include<iostream> #include<cstring> using namespace std; #define M 101 int main(){ int n,m; while(cin>>n>>m){ int least[M],most[M],c1[M]={1},c2[M]={0},i,j,k; for(i=0;i<n;i++) cin>>least[i]>>most[i];原创 2011-05-27 12:12:00 · 634 阅读 · 0 评论 -
HDU 2082 找单词
<br />总得来说就是一道水题,只不过可以包括很多关于基础母函数的概念<br />#include<iostream> #include<cstring> using namespace std; #define M 51 int main(){ int t; cin>>t; while(t--){ int charnum[27]={0},i,j,k,c1[M]={1},c2[M]={0},count; //c1[0]=1,可以说是母函数求值的一个入口,后面的步骤全部是从这里出原创 2011-05-26 22:46:00 · 886 阅读 · 0 评论 -
HDU 1521 排列组合
#include using namespace std;double facots[]={1,1,2,6,24,120,720,5040,40320,362880,3628800};/*求排列数的母函数。ans=m!/(n1!*n2!*n3!……*nk!) m其中∑ nk =m ,因为刚好选定m件物品。 k=1意思就是同一种物品无论怎么排列都只算做一种,所以当选某原创 2011-06-11 13:26:00 · 2601 阅读 · 0 评论 -
hdu1709 the blance
#include #include #include #include #include using namespace std; /* hdu1709_母函数 sum{weight[i]}不可称的数 起点为0,刚开始以为纯hash就可以了,但是一直WrongAnswer,表示相当无奈 */ int hashx[15005],hashy[15005],Max,weight[105],no原创 2011-12-06 20:43:21 · 617 阅读 · 0 评论