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 ...
随机推荐
- 一年三篇IF大于7的牛人告诉你怎么写SCI
一年三篇IF大于7的牛人告诉你怎么写SCI 1 研究生必备四本 俗话说好记性不如烂笔头,所以一定要首先养成做笔记的好习惯!作为研究生下面这几个本子是必不可少的: 1.实验记录本(包括试验准备本),这当 ...
- HDU-Billboard-2795(线段树)
hdu2795 Billboard Time Limit: 20000/8000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Other ...
- c++ 11 vs 98
在求最长子字符串中题中要遍历个上万字符数据 1.使用c++11代码 for (auto ch : s) { auto ss = vsi[ch]; vsi[ch].insert(i); i++; } 2 ...
- Ie浏览器TextBox文本未居中
Ie浏览器TextBox文本未居中,而其他浏览器无问题时,可能原因是未设置垂直居中 vertical-align:middle
- PHP 获取linux服务器性能CPU、内存、硬盘、进程等使用率
数据库配置文件: conn.php <?php define("MONITORED_IP", "172.16.0.191"); //被监控的服务器IP地址 ...
- poj 3469 Dual Core CPU 最小割
题目链接 好裸的题....... 两个cpu分别作为源点和汇点, 每个cpu向元件连边, 权值为题目所给的两个值, 如果两个元件之间有关系, 就在这两个元件之间连边, 权值为消耗,这里的边应该是双向边 ...
- MacOS copy图标shell脚本
不会shell 同学做的... 可以看见在当前文件夹下创建了一个icons文件夹 最后还压缩了文件夹 #!/bin/bash # readPlist [plist] [key] function r ...
- rails总结
rails总结 注意:本文档以rails3.2版本为基础,并且用RubyMine 4.0.3作为ide 一.rails的结构与重要文件 Rails 是一个MVC库.同时,Rails的特点就是:惯用名优 ...
- HDU 5768 Lucky7(CRT+容斥原理)
[题目链接] http://acm.hdu.edu.cn/showproblem.php?pid=5768 [题目大意] 求出一个区间内7的倍数中,对于每个ai取模不等于bi的数的个数. [题解] 首 ...
- Mirantis Certification summary
preface Mirantis Certification (MCA100 )summary roughly question types handy remain by Ruiy!