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. 《mahout实战》

    <mahout实战> 基本信息 原书名:Mahout in action 作者: (美)Sean Owen    Robin Anil    Ted Dunning    Ellen Fr ...

  2. 实现Hadoop的Writable接口Implementing Writable interface of Hadoop

    As we saw in the previous posts, Hadoop makes an heavy use of network transmissions for executing it ...

  3. OpenCV 脸部跟踪(1)

        本文中的知识来自于Mastering  opencv with practical computer vision project一书.     本文实施的脸部跟踪算法都是基于数据驱动的,主要 ...

  4. 树状数组(Binary Indexed Tree) 总结

    1.“树状数组”数据结构的一种应用 对含有n个元素的数组(a[1],...,a[k],...,a[n]): (1)求出第i个到第j个元素的和,sum=a[i]+...+a[j]. 进行j-i+1次加法 ...

  5. 掌握Sed命令

    带书签PDF版,喜欢的话,欢迎多提意见和建议,你的支持是血蝙蝠最大的前进动力! http://download.csdn.net/detail/challenge_c_plusplus/6480007 ...

  6. java 中的resultset的类型

    结果集(ResultSet)是数据中查询结果返回的一种对象,可以说结果集是一个存储查询结果的对象,但是结果集并不仅仅具有存储的功能,他同时还具有操纵数据的功能,可能完成对数据的更新等. 结果集读取数据 ...

  7. Android常用http请求框架 简介及现状

    JDK支持的HttpUrlConnection HttpUrlConnection是JDK里提供的联网API,是最原始最基本的API,大多数开源的联网框架基本上也是基于此进行的封装的.HttpUrlC ...

  8. 13个可实现超棒数据可视化效果的Javascript框架

    随着商业及其相关需求的发展,数据成为越来越重要的元素之一,为了更加直观和明显的展示商业潜在的趋势和内在的特性,我们需要使用图表和图形的方式来直观动态的展示数据内在秘密,在今天的这篇文章中我们推荐12款 ...

  9. jQuery的搜索关键词自动匹配插件

    相信许多人都会用过搜索栏自动匹配关键词的功能,无论是像google的专业搜索引擎,还是普通的网站,现在许多都用上了这种关键词匹配技术,本文介绍的用jQuery实现的关键词匹配技术,当然要整合到自己的系 ...

  10. 如何使用动画和精灵表单 Cocos2d-x 2.1.4

            本文实践自 Ray Wenderlich.Tony Dahbura 的文章< How to Use Animations and Sprite Sheets in Cocos2D ...