Ignatius and the Princess III

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 9893    Accepted Submission(s): 6996

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

"The second problem is, given an positive integer N, we define an equation like this:
  N=a[1]+a[2]+a[3]+...+a[m];
  a[i]>0,1<=m<=N;
My question is how many different equations you can find for a given N.
For example, assume N is 4, we can find:
  4 = 4;
  4 = 3 + 1;
  4 = 2 + 2;
  4 = 2 + 1 + 1;
  4 = 1 + 1 + 1 + 1;
so the result is 5 when N is 4. Note that "4 = 3 + 1" and "4 = 1 + 3" is the same in this problem. Now, you do it!"

 
Input
The input contains several test cases. Each test case contains a positive integer N(1<=N<=120) which is mentioned above. The input is terminated by the end of file.
 
Output
For each test case, you have to output a line contains an integer P which indicate the different equations you have found.
 
Sample Input
4 10 20
 
Sample Output
5 42 627
 
Author
Ignatius.L
 
母函数.....对于任意一个数你   (1+x+x^2+x^3+x^4+x^5+x^6+x^7...+x^n)*(1+x^2+x^4+x^6+x^8+x^10+.....)*(1+x^3+.....);
 #include<iostream>
#include<vector>
using namespace std;
int main()
{
int n,i,j,k;
while(cin>>n)
{
vector<int>c1(n+,);
vector<int>c2(n+,);
for(i=;i<=n;i++)
{
for(j=;j<=n;j++)
{
for(k=;k+j<=n;k+=i)
{
c2[j+k]+=c1[j];
}
}
for(j=;j<=n;j++)
{
c1[j]=c2[j];
c2[j]=;
}
}
cout<<c1[n]<<endl;
}
return ;
}

HDUOJ----Ignatius and the Princess III的更多相关文章

  1. HDUOj Ignatius and the Princess III 题目1002

     母函数  组合数学 #include<stdio.h> int c1[125]; int c2[125]; int main() { int n,i,j,k; while(scanf ...

  2. hdu acm 1028 数字拆分Ignatius and the Princess III

    Ignatius and the Princess III Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K ...

  3. hdu 1028 Ignatius and the Princess III(DP)

    Ignatius and the Princess III Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K ...

  4. hdu 1028 Ignatius and the Princess III 简单dp

    题目链接:hdu 1028 Ignatius and the Princess III 题意:对于给定的n,问有多少种组成方式 思路:dp[i][j],i表示要求的数,j表示组成i的最大值,最后答案是 ...

  5. HDOJ 1028 Ignatius and the Princess III (母函数)

    Ignatius and the Princess III Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K ...

  6. HDU1028 Ignatius and the Princess III 【母函数模板题】

    Ignatius and the Princess III Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K ...

  7. Ignatius and the Princess III

    Ignatius and the Princess III Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K ...

  8. Ignatius and the Princess III --undo

    Ignatius and the Princess III Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 65536/32768K (J ...

  9. Ignatius and the Princess III(母函数)

    Ignatius and the Princess III Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K ...

  10. HDU 1028 Ignatius and the Princess III 整数的划分问题(打表或者记忆化搜索)

    传送门: http://acm.hdu.edu.cn/showproblem.php?pid=1028 Ignatius and the Princess III Time Limit: 2000/1 ...

随机推荐

  1. PHP命名空间学习笔记

    命名空间的支持版本:PHP 5 > 5.3.0,PHP 7 . 什么是命名空间 从广义上来说,命名空间是一种封装事物的方法.在很多地方都可以见到这种抽象概念.例如,在操作系统中目录用来将相关文件 ...

  2. 【tyvj五月有奖赛 暨Loi 55 Round #1】

    解题报告: 傻逼错误天天犯QAQ 第一题:简单DP,f[i][j]表示第 i 道题选 j 的最大得分,可以从f[i-1][j-1],f[i-1][j],f[i-1][j+1]转移过来,其实是可以滚动数 ...

  3. Android中样式及主题

    Android应用程序中不可避免的需要使用的样式和主题,样式指定一般指定View的高度.字体.字体颜色.背景,Android里的样荐定义在Style.xml文件里.主题也是一种样式,只不过它是应用在整 ...

  4. Search for a Range leetcode java

    题目: Given a sorted array of integers, find the starting and ending position of a given target value. ...

  5. 原生js获取宽高与jquery获取宽高的方法的关系

    说明:1.因为获取高度的情况跟获取宽度的情况一样,所以以下只说获取宽度的情况.  2.以下所说的所有方法与属性所返回的值都是不带单位的.  3.为了方便说明,以下情况采用缩写表示:  obj -> ...

  6. navigator.geolocation在IOS10系统中无法定位问题

    在使用地图需要定位的朋友都可能遇到这个问题,参考的文章说的是用百度地图,我用的是腾讯地图,但是其中的原理差不多.所以谢谢这些提供资源的大神们. if (navigator.geolocation) { ...

  7. IOS Key-Value Observing (KVO)

    kvo,与观察者模式类似,通过给指定的对象设置观察者,来检测对象的变化,当指定的对象的属性被修改后,用于作为观察者的对象会接收到通知.简单的说就是每次指定的被观察的对象的属性被修改后,kvo就会自动通 ...

  8. android 创建通知栏Notification

    ///// 第一步:获取NotificationManager NotificationManager nm = (NotificationManager) getSystemService(Cont ...

  9. HP Onboard Administrator 固件升级

    HP Onboard Administrator是HP公司服务器的远程管理平台.更新是一个非常简单的过程,可以完全通过办公自动化web管理界面. 1. 下载所需二进制文件 下载地址:HP BladeS ...

  10. what difference between libfm and libffm

    https://www.kaggle.com/users/25112/steffen-rendle/forum Congratulations to Yu-Chin, Wei-Sheng, Yong ...