#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
int n,i;
int a[4]={1,2,3,4};
//cin>>n;
while(next_permutation(a,a+4)){ for(i=0;i<4;i++)
cout<<a[i]<<" ";
cout<<endl;}
return 0;
}
//排列的模板
*/
#include <iostream>
using namespace std;
int main()
{
int i,j,k,n,m;
int c1[1001],c2[1001];
while(cin>>n)
{
for(i=0;i<=n;i++)
{
c1[i]=1;
c2[i]=0;
}
for(i=2;i<=n;i++)
{
for(j=0;j<=n;j++)
for(k=0;k+j<=n;k+=i)
c2[j+k]+=c1[j];
for(j=0;j<=n;j++)
{
c1[j]=c2[j];
c2[j]=0;
}
}
cout<<c1[n]<<endl;
}
return 0;
}
//母函数模板

母函数&&排列(模板)的更多相关文章

  1. hdu 1028 Ignatius and the Princess III(母函数入门+模板)

    Description "Well, it seems the first problem is too easy. I will let you know how foolish you ...

  2. 母函数(Generation Function) 入门 + 模板

    转自:母函数 入门 + 模板  感谢 在数学中,某个序列的母函数(Generating function,又称生成函数)是一种形式幂级数,其每一项的系数可以提供关于这个序列的信息.使用母函数解决问题的 ...

  3. 动态规划:HDU-1398-Square Coins(母函数模板)

    解题心得: 1.其实此题有两种做法,动态规划,母函数.个人更喜欢使用动态规划来做,也可以直接套母函数的模板 Square Coins Time Limit: 2000/1000 MS (Java/Ot ...

  4. HDU 2082 找单词 (普通型 数量有限 母函数)

    传送门: http://acm.hdu.edu.cn/showproblem.php?pid=2082 找单词 Time Limit: 1000/1000 MS (Java/Others)    Me ...

  5. HDU 1284 钱币兑换问题(普通型 数量无限的母函数)

    传送门: http://acm.hdu.edu.cn/showproblem.php?pid=1284 钱币兑换问题 Time Limit: 2000/1000 MS (Java/Others)    ...

  6. HDU_2082 找单词 【母函数的应用】

    题目: 假设有x1个字母A, x2个字母B,..... x26个字母Z,同时假设字母A的价值为1,字母B的价值为2,..... 字母Z的价值为26.那么,对于给定的字母,可以找到多少价值<=50 ...

  7. flex控件总结

    Flex基本控件总结 一.flex控件的分类:文本控件(text controls).数据源控件(data provider controls).菜单控件       (menu  controls) ...

  8. R-----shiny包的部分解释和控件介绍

    R-----shiny包的部分解释和控件介绍 作者:周彦通.贾慧 shinyApp( ui = fixedPage( fixedPanel( top = 50, right=50, width=200 ...

  9. Ignatius and the Princess III HDU - 1028

    题目传送门:https://vjudge.net/problem/HDU-1028 思路:整数拆分构造母函数的模板题 1 //#include<bits/stdc++.h> 2 #incl ...

随机推荐

  1. ‘for’ loop initial declarations are only allowed in C99 mode

    #include <stdio.h>int main(){ for(int i=0;i<10;i++){ printf("\n%d",i); } return 0 ...

  2. JS 日常

    判断一个字符串是否在另一个字符串里面 var str = 'bblText'; if(str.indexOf("Text") > 0)  alert("包含了Tex ...

  3. gitHub远程分支创建

    1.在本地master上分出一个项目分支 git checkout -b bug1_dujie git checkout -b bug1_dujie origin/master 在远程添加分支 $gi ...

  4. 使用微妙计算PHP脚本执行时间

    在PHP中,大多数的时间格式都是以UNIX时间戳表示的,而UNIX时间戳是以s(秒)为最小的计量时间的单位.这对某些应用程序来说不够精确,所以可以调用microtime()返回当前UNIX时间戳和微妙 ...

  5. C语言基础学习基本数据类型-浮点型

    float和double 加了小数点的数都是浮点数.C语言有两种书写浮点数的方式,一种是使用常用的标准小数点表示法,如下: 0.00056 8.0 1.23 第二种表示浮点值叫做E表示法.下面是一些例 ...

  6. JS之路——字符串函数

    JS自带函数concat将两个或多个字符的文本组合起来,返回一个新的字符串.var a = "hello";var b = ",world";var c = a ...

  7. 终端编写c程序

    著作权归作者所有.商业转载请联系作者获得授权,非商业转载请注明出处.作者:JackAlan链接:http://www.zhihu.com/question/21483375/answer/322672 ...

  8. Substrings

    hdu1238:http://acm.hdu.edu.cn/showproblem.php?pid=1238 题意:给你n个串,求一个子串,这个子串在所有串中都出现,或者在逆串中出现.求最大的这个子串 ...

  9. 使用JQUERY实现局部页面定时刷新

    没办法,运维会一点点前端,还是有好处的.. 说不定,BOOTSTRAP也得会一点点.. 本想用流式输出的搞定的,但没搞定,就取巧了... 代理简单: <script src="//cd ...

  10. HBase MemStoreFlusher

    HBase MemStore Flush由类org.apache.hadoop.hbase.regionserver.MemStoreFlusher实现,具体表现为HRegionServer中的一个实 ...