hdu 1028 母函数 一个数有几种相加方式
///hdu 1028 母函数 一个数有几种相加方式
#include<stdio.h>
#include<string.h>
#include<iostream>
#include<algorithm>
#define INF 1000000009
using namespace std; const int _max = ;
int c1[_max], c2[_max];
int main()
{ int n,i,j,k;
while(cin>>n)
{
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[j+k]+=c1[j];
}
}
for(j=;j<=n;j++)
{
c1[j]=c2[j];
c2[j]=;
}
}
cout << c1[n] << endl;
}
return ;
}
hdu 1028 母函数 一个数有几种相加方式的更多相关文章
- *HDU 1028 母函数
Ignatius and the Princess III Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K ...
- 母函数 <普通母函数(HDU - 1028 ) && 指数型母函数(hdu1521)>
给出我初学时看的文章:母函数(对于初学者的最容易理解的) 普通母函数--------->HDU - 1028 例题:若有1克.2克.3克.4克的砝码各一 枚,能称出哪几种重量?各有几种可能方案? ...
- Ignatius and the Princess III HDU - 1028 || 整数拆分,母函数
Ignatius and the Princess III HDU - 1028 整数划分问题 假的dp(复杂度不对) #include<cstdio> #include<cstri ...
- HDU 1028 Ignatius and the Princess III(母函数整数拆分)
链接:传送门 题意:一个数n有多少种拆分方法 思路:典型母函数在整数拆分上的应用 /********************************************************** ...
- HDU 1028 Ignatius and the Princess III (生成函数/母函数)
题目链接:HDU 1028 Problem Description "Well, it seems the first problem is too easy. I will let you ...
- hdu 1028 Ignatius and the Princess III(母函数)
题意: N=a[1]+a[2]+a[3]+...+a[m]; a[i]>0,1<=m<=N; 例如: 4 = 4; 4 = 3 + 1; 4 = 2 + 2; 4 = 2 + ...
- The Balance HDU - 1709 母函数(板子变化)
题意: 现在你被要求用天平和一些砝码来量一剂药.当然,这并不总是可以做到的.所以你应该找出那些不能从范围[1,S]中测量出来的品质.S是所有重量的总质量. 输入一个n,后面有n个数,表示这n个物品的质 ...
- ACM: HDU 1028 Ignatius and the Princess III-DP
HDU 1028 Ignatius and the Princess III Time Limit:1000MS Memory Limit:32768KB 64bit IO Form ...
- hdu 1028 Ignatius and the Princess III 简单dp
题目链接:hdu 1028 Ignatius and the Princess III 题意:对于给定的n,问有多少种组成方式 思路:dp[i][j],i表示要求的数,j表示组成i的最大值,最后答案是 ...
随机推荐
- python xpath
提取Item 选择器介绍 我们有很多方法从网站中提取数据.Scrapy 使用一种叫做 XPath selectors的机制,它基于 XPath表达式.如果你想了解更多selectors和其他机制你可以 ...
- 新的 Windows Azure 网络安全性白皮书
下载新的 Windows Azure 网络安全性白皮书. Windows Azure 网络提供了将虚拟机安全连接到其他虚拟机所需的基础结构,以及云和内部部署数据中心之间的网桥. 本白皮书旨在挖掘这些内 ...
- CSharp Algorithm - Replace multiplication operator with a method
/* Author: Jiangong SUN */ How to replace multiplication operation with a method? For example, you h ...
- VMware Player 使用错误集锦
1.执行VMware Player 弹出"开机时出错:内部错误"的提示.虚拟机执行不了,例如以下图: 解决的方法: 以管理员身份执行. 可能如今登录windows的 ...
- 使用链表实现队列------《数据结构与算法分析-C语言描述》
经过ubuntu的gcc验证 一.头文件 que_link.h #ifndef _QUE_LINK_H_ #define _QUE_LINK_H_ struct que_record; typedef ...
- Linux 经典电子书共享下载
Linux 经典电子书共享下载 Linux网络管理员指南--Linux领域两位领导人物的作品—相当于“Linux 文档项目”.rar vim用户手册_603.0.pdf [Linux系统管理技术手册( ...
- Swift - 使用UI Dynamics给UIKit组件添加重力和碰撞行为
UI Dynamics是UIKit的一个新组成部分,它向iOS中的视图提供了与物理学有关的功能和动画.可以让你向视图中引入力和物理属性,可以让你的视图弹跳,舞动,受重力影响等等. 下面通过样例,演示使 ...
- NHibernate - HQL - 添加和更改
添加: /// <summary> /// 等待乙方做出回应 A /// </summary> private void button2_Click_1(object send ...
- JVM类加载过程学习总结
JVM类加载过程学习总结 先不说JVM类加载的原理,先看实例: NormalTest类,包含了一个静态代码块,执行的任务就是打印一句话. /** * 在正常类加载条件下,看静态代码块是否会执行 * @ ...
- Cocos2d-x教程第(11)讲-利用遮罩(蒙版)CCLayerColor制作新手引导界面(上)
欢迎转载,转载时请注明原文出处:http://blog.csdn.net/u012945598/article/details/17280019 源码下载地址:http://download.csdn ...