题目大意:有面值分别为。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]);  }
}

转载于:https://www.cnblogs.com/forever97/p/3662345.html

HDU 1398 Square Coins相关推荐

  1. HDU 1398 Square Coins

    母函数简单应用 题目: Square Coins Problem Description People in Silverland use square coins. Not only they ha ...

  2. hdu 1398 Square Coins/hdu 1028 Ignatius and the Princess III

    两道母函数的模板题: http://acm.hdu.edu.cn/showproblem.php?pid=1398 View Code #include<iostream>#include ...

  3. HDOJ 1398 Square Coins

    母函数"第一季",无压力AC~ View Code 1 //#include <fstream> 2 #include <iostream> 3 using ...

  4. 北邮OJ 2016 网预-Square Coins

    时间限制 1000 ms 内存限制 65536 KB 题目描述 Artoria, also known as Saber-chan, was born into a time of chaos and ...

  5. HDU 5985 Lucky Coins 数学

    Lucky Coins 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5985 Description Bob has collected a lot ...

  6. hdu 5079 Square

    http://acm.hdu.edu.cn/showproblem.php?pid=5079 题意: n*n网格,每个格子可以涂黑色或白色,有的格子必须涂黑色 问最大白色正方形边长分别为0,1,2,- ...

  7. hdu 5903 Square Distance

    这题题解dp不懂 因为不知道它怎么记录dp的答案的 字符串那么长 我是贪心过得,当时还被四个人hack,都没成功,hhhhh 大意就是优先从头取字典序小的字母,担也要让后面不管怎么取都合法 #incl ...

  8. HDU 1518 Square

    dfs+剪枝. AC代码例如以下: ///dfs+剪枝 62MS 300K#include<iostream> #include<cstring> #include<al ...

  9. 杭电OJ分类题目(1)

    原题出处:HDOJ Problem Index by Type,http://acm.hdu.edu.cn/typeclass.php 杭电OJ分类题目(1) HDU Introduction HDU ...

最新文章

  1. echart 多柱图只显示部分数据标签_2分钟上手、3小时学会无代码软件开发---Echarts数据可视化...
  2. Linux命令查看服务器信息
  3. JAVA SE学习day16:reflect
  4. 这几种程序员前途无量!你在其中吗?
  5. PHP7 ini 配置大全
  6. 在 Mac OS X Lion 下修改 Hosts 的四种方法
  7. 防止电子邮件地址被搜索到的新方法
  8. 验证内容是否为空的多种办法 1210 c#
  9. 经典算法详解 之 递归算法
  10. kafka消费者分区消费策略
  11. python的字符串包括哪些_python怎么判断字符串是否包含某些字符
  12. angular移除事件绑定事件绑定_002-js的三种事件绑定方式
  13. 画PCB开始前的准备工作
  14. 词汇的积累 —— 同义反复、写景状物
  15. jquery的快捷手册
  16. Rust : Pointer......to be continued
  17. 优锘|ThingJS-X零代码平台:七大智慧场景全新Demo
  18. 抖音小程序微信支付php,抖音头条小程序微信支付开通绑定最全教程!
  19. 好看的滚动条样式,css实现好看的滚动条样式
  20. Excel表格中输入一个姓,就可以选择输入需要的姓名了

热门文章

  1. 多个旅游网站被挂马 五一假期外出旅游应小心
  2. 我能使用这个Intent吗?
  3. pku1384---Piggy-Bank(动态规划)
  4. 对异步脉冲信号的处理——不归0翻转电路
  5. FPGA开发中全局复位置位(GSR)
  6. Matlab如何读取文本文件
  7. matplotlib cmap
  8. VC++ MSXML创建XML文件以及对XML文档解析
  9. 使用webpack打包的后,公共请求路径的配置问题
  10. Problem A: 平面上的点——Point类 (I)