hdu_1028_Ignatius and the Princess III
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
"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!"
#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的更多相关文章
- 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 ...
- 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 ...
- hdu 1028 Ignatius and the Princess III 简单dp
题目链接:hdu 1028 Ignatius and the Princess III 题意:对于给定的n,问有多少种组成方式 思路:dp[i][j],i表示要求的数,j表示组成i的最大值,最后答案是 ...
- HDU 1028Ignatius and the Princess III(母函数简单题)
Ignatius and the Princess III Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d ...
- HDOJ 1028 Ignatius and the Princess III (母函数)
Ignatius and the Princess III Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K ...
- HDU1028 Ignatius and the Princess III 【母函数模板题】
Ignatius and the Princess III Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K ...
- Ignatius and the Princess III
Ignatius and the Princess III Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K ...
- Ignatius and the Princess III --undo
Ignatius and the Princess III Time Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/32768K (J ...
- Ignatius and the Princess III(母函数)
Ignatius and the Princess III Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K ...
随机推荐
- [转]Using the Interop Activity in a .NET Framework 4 Workflow
本文转自:http://msdn.microsoft.com/en-us/library/ee264174(v=vs.100).aspx This topic applies to Windows W ...
- AJPFX总结关于Java中过滤出字母、数字和中文的正则表达式
1.Java中过滤出字母.数字和中文的正则表达式 (1)过滤出字母的正则表达式 [^(A-Za-z)] (2) 过滤出 数字 的正则表达式 [^(0-9)] (3) 过滤出 中文 的正则 ...
- 学习笔记 第十二章 CSS3+HTML5网页排版
第12章 CSS3+HTML5网页排版 [学习重点] 正确使用HTML5结构标签 正确使用HTML5语义元素 能够设计符合标准的网页结构 12.1 使用结构标签 在制作网页时,不仅需要使用< ...
- JS中的Promise
Promise 对象有以下两个特点. (1)对象的状态不受外界影响.Promise 对象代表一个异步操作,有三种状态:Pending(进行中).Resolved(已完成,又称 Fulfilled)和 ...
- java synchronized(object/this)的 区别
1.synchronized(object) package test.thread; import java.io.IOException; import org.junit.Test; /* * ...
- javaEE web 系统安装时自定义初始化
通常JavaWeb项目在第一次启动时我们需要做一些初始化工作,比如:初始化一个管理员的登录账户和密码,配置缓存.定时任务等,这些操作可以通过手工修改数据库完成,但是容易出错且繁琐,而且也很麻烦.如果这 ...
- 详解java基础--抽象类、接口与多态
抽象类.接口.多态都是面向对象中很基础的东西,我相信看到能本篇博客的人本不会再纠结它的基本定义了,本篇文章将尽量的更加深层次的挖掘其内涵,希望能对大家有帮助. 一.抽象类 1.形式 abstract ...
- hibernate inverse属性
修改街道对应的区道信息: 修改后会发现程序执行了两次修改操作: 原因: 区道与街道是一对多的关系: 由于Hibernate是双向维护外键,所以当修改区道中的街道时,会修改一次外键:在修改街道中的区道时 ...
- apm - 查询高级电源管理(APM) BIOS
总览 apm [ - vVmsS ] 描述 apm 读取 /proc/apm 并用人能看懂的格式输出.因为提供了首要的电池状态,这个命令在有兼容的 APM BIOS 的笔记本电脑上非常有用. apm ...
- viewstate 与 session 区别
Session存在于服务器端可以跨页面.耗费服务器资源.ViewState载体是页面文件,消耗带宽. EG: viewstate是存储在客户端的隐藏信息,当服务器接受请求回传时可以将viewstate ...