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. html 相对定位 绝对 定位 css + div

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 0 Transitional//EN""http://www.worg/TR/xh ...

  2. [BZOJ1085][SCOI2005]骑士精神 搜索

    题目链接:http://www.lydsy.com/JudgeOnline/problem.php?id=1085 大的思路是迭代加深搜索,我们加一个明显的剪枝,当棋盘中位置不对的骑士的数目加上已经走 ...

  3. 【JavaScript】之函数的this

    提起函数中的this是很多初学者较为苦恼的,也是很多工作一段时间的人也存在误解的,你问this指向的是谁,大多数人会随口一答当然是指向调用这个函数的元素,当然这也没什么错,可是函数的调用方法不同thi ...

  4. Fragment中获取Activity的Context (转)

    Fragment中获取Activity的Context时只需要this.getActivity()即可.     而不是许多人说的this.getActivity().getApplicationCo ...

  5. org.springframework.orm.hibernate4.support.OpenSessionInViewFilter

    ---恢复内容开始--- /* * Copyright 2002-2014 the original author or authors. * * Licensed under the Apache ...

  6. MySQL(MMM架构使用)

    本案例要求基于普通版的MySQL服务器改造MMM架构,完成以下任务操作:启动MMM集群架构设置集群中服务器为online状态MySQL-MMM架构部署完成后需要启动,数据库端启动mmm-agent进程 ...

  7. zabbix基础安装

    环境依赖:LNMP或者LAMP 简介参考:http://blog.51cto.com/zhang789/1868880 一.准备 我安装的环境及其版本如下: 系统版本 CentOS Linux rel ...

  8. SqlServer2012学习 - 基本数据类型认知

    精确数字: 1.整数 int是Sql Server主要整数类型.tinyint,smallint,int 不会自动转成bigint. 大于 2,147,483,647 的整数常量将转换为 decima ...

  9. JS Object 属性判断

    in 方法 var shapeInfo = {name:“lium”}; if (“name” in shapeInfo) {...}

  10. 使用nsight调试caffe

    首先你需要下载caffe源码,然后先编译好,注意一定要将Makefile.config里的DEBUG := 1注释掉 可以看到注释掉debug后编译会生成的.build_debug目录,调试过程中需要 ...