Ignatius and the Princess III

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

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
 
 #include <stdio.h>
int main()
{
int i,j,k,n;
int c1[],c2[];
while(scanf("%d",&n)!=EOF)
{
for(i=;i<=n;i++)
{
c1[i]=;
c2[i]=;
}
for(i=;i<=n;i++)
{
for(j=;j<=n;j++)
for(k=;k+j<=n;k+=i)
{
c2[k+j]+=c1[j];
}
for(j=;j<=n;j++)
{
c1[j]=c2[j];
c2[j]=;
}
}
printf("%d\n",c1[n]);
}
return ;
}

hdu_1028_Ignatius and the Princess III的更多相关文章

  1. 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 ...

  2. 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 ...

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

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

  4. HDU 1028Ignatius and the Princess III(母函数简单题)

     Ignatius and the Princess III Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d ...

  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 ...

随机推荐

  1. [ USACO 2013 OPEN ] Photo

    \(\\\) Description 有一个长度为 \(n\) 的奶牛队列,奶牛颜色为黑或白. 现给出 \(m\) 个区间 \([L_i,R_i]\) ,要求:每个区间里 有且只有一只黑牛 . 问满足 ...

  2. Java数据类型和MySql数据类型对应一览 [转]

    类型名称 显示长度 数据库类型 JAVA类型 JDBC类型索引(int) 描述             VARCHAR L+N VARCHAR java.lang.String 12   CHAR N ...

  3. .NET 之ViewState的本质

    ViewState是如何实现这些功能. 以名值对的方式来存控件的值,和Hashtable的结构类似: 跟踪那些ViewState中出现改变的值,以便对这些脏数据(dirty)进行进一步的处理: 通过序 ...

  4. 重装系统后,重新搭建Selenium Server+Firefox环境

    摘要:搭建Selenium自动化测试环境其实是非常简单的事情,在态度上我们不要把它当成难事:折腾起来是很愉快的,自然就成功了. 下面把这次安装的过程记录下来,一来是加深印象,二来可以给大家提供参考. ...

  5. C/C++ 运算符重载、数据类型转换

    1.运算符就是“+”.“>>”等符号,对运算符重载实质就是对函数的重载,这样运算符就能在原有基础上增加新功能,不能自己定义新运算符,只能对已有运算符重载,重载运算符后不能改变运算符本身的特 ...

  6. HP11.31安装11.2.0.3实施手册

    1 前言 此文档详细描述了Oracle 11gR2 数据库在HP11.31上的安装RAC的检查及安装步骤.文档中#表示root用户执行,$表示grid或oracle用户执行. 2 系统环境 操作系统环 ...

  7. Linux之基础命令——文件查看

    cat(连接文件并打印) -n :由 1 开始对所有输出的行数编号. -b :和 -n 相似,只不过对于空白行不编号. -s :当遇到有连续两行以上的空白行,就代换为一行的空白行. [cat a b  ...

  8. mysql5.7 this is incompatible with sql_mode=only_full_group_by错误

    解决办法: https://blog.csdn.net/qq_42175986/article/details/82384160 前言: 一.原理层面 这个错误发生在mysql 5.7 版本及以上版本 ...

  9. VC:UI编程

    VC++中给对话框设置背景图片的方法 -----------------------------------------------------方法一(铺满窗口)------------------- ...

  10. 五、面向切面的spring(1)

    spring的依赖注入看完了,接下来是spring中与DI一并重要的AOP了,开始吧,GO. 在软件开发中,散布于应用中多处的功能被称为横切发关注点,通常来讲,这些横切关注点从概念上市与应用的业务逻辑 ...