HDU 1398 Square Coins
题目大意:有面值分别为。1,4,9,.......17^2的硬币无数多个。问你组成面值为n的钱的方法数。
最简单的母函数模板题:
#include <cstdio>
#include <cstring>
using namespace std;
int c1[305],c2[305],n;
int main(){
while(scanf("%d",&n),n){
for(int i=0;i<=n;i++)c1[i]=1,c2[i]=0;
for(int i=2;i<18;i++){
for(int j=0;j<=n;j++){
for(int k=0;k+j<=n;k+=i*i)c2[j+k]+=c1[j];
}
memcpy(c1,c2,sizeof c2); memset(c2,0,sizeof c2);
}
printf("%d\n",c1[n]);
}
}
HDU 1398 Square Coins的更多相关文章
- hdu 1398 Square Coins 分钱币问题
Square Coins Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Submit ...
- 题解报告:hdu 1398 Square Coins(母函数或dp)
Problem Description People in Silverland use square coins. Not only they have square shapes but also ...
- hdu 1398 Square Coins (母函数)
Square Coins Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Tota ...
- hdu 1398 Square Coins(简单dp)
Square Coins Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Pro ...
- hdu 1398 Square Coins(生成函数,完全背包)
pid=1398">链接:hdu 1398 题意:有17种货币,面额分别为i*i(1<=i<=17),都为无限张. 给定一个值n(n<=300),求用上述货币能使价值 ...
- HDU 1398 Square Coins 整数拆分变形 母函数
欢迎参加——BestCoder周年纪念赛(高质量题目+多重奖励) Square Coins Time Limit: 2000/1000 MS (Java/Others) Memory Limit ...
- 杭电ACM hdu 1398 Square Coins
Problem Description People in Silverland use square coins. Not only they have square shapes but also ...
- HDU 1398 Square Coins(母函数或dp)
Square Coins Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Tota ...
- HDU 1398 Square Coins(DP)
Square Coins Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Tota ...
随机推荐
- OC 中的block使用
在iOS的开发过程中,使用块的地方很多也很方便,但是在使用块的过程中要注意内存泄露的问题. 在块创建的时候,会对块内的所有对象的引用计数加一,直到块销毁,所以在使用块的过程中需要我们进行处理,在这里以 ...
- 如何升级CentOS 6.5下的MySQL
如何升级CentOS 6.5下的MySQL http://jingyan.baidu.com/article/48a42057e9b9bca9242504ab.html | 浏览:1136 | 更新: ...
- TCP/IP的网际层协议——ARP
MAC地址对于每一台设备是全球唯一的,该地址被烧录在网卡的硬件电路上.MAC地址由12位十六进制数表示,其中前6位标识网卡的制造厂商,后6位是网卡的序列号.在以太网中,一个主机要和另一个主机进行通信, ...
- ROS的文件系统
这篇博客介绍一下ROS的文件系统的基本概念,用户可以直接在官方网站:http://wiki.ros.org/ROS/Tutorials/NavigatingTheFilesystem去查看官方手册. ...
- windows server system32下常见快捷指令
win+R 命令行窗口 cmd dos命令窗口 mstsc 远程登录输入窗口 calc 快速打卡计算器 control 打开控制面板 eve ...
- mobile web 手机开发
1. -webkit-tap-highlight-color -webkit-tap-highlight-color:rgba(255,255,255,0); 用来把android上点击网页时出现 ...
- USB創意讀卡機設計特別獎
- android之ArrayAdapter的重写
昨天介绍了ArrayAdapter的使用,今天介绍一下更加实用的一点,对它进行重写,满足自己的个性化设计需要. ArrayAdapter(数组适配器)一般用于显示一行文本信息,所以比较容易. publ ...
- php抽象类和接口
接口 使用接口,你可以指定某个类必须实现那些方法,但是不需要定义这些方法的具体内容,我们可以通过interface来定义一个接口,就像定义标准类一样,但其中定义所有的方法都是空的,接口中定义的所有的方 ...
- 315M无线发射模块天线的长度计算
波长=光速/频率=300/315=0.952米 1/4波长须要的天线长度=波长*1/4=0.952/4=0.238米 考虑导线传播高频信号的缩短率在0.98左右,因此天线长度=0.238*0.98=0 ...