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]); }
}
转载于:https://www.cnblogs.com/forever97/p/3662345.html
HDU 1398 Square Coins相关推荐
- HDU 1398 Square Coins
母函数简单应用 题目: Square Coins Problem Description People in Silverland use square coins. Not only they ha ...
- 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 ...
- HDOJ 1398 Square Coins
母函数"第一季",无压力AC~ View Code 1 //#include <fstream> 2 #include <iostream> 3 using ...
- 北邮OJ 2016 网预-Square Coins
时间限制 1000 ms 内存限制 65536 KB 题目描述 Artoria, also known as Saber-chan, was born into a time of chaos and ...
- HDU 5985 Lucky Coins 数学
Lucky Coins 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5985 Description Bob has collected a lot ...
- hdu 5079 Square
http://acm.hdu.edu.cn/showproblem.php?pid=5079 题意: n*n网格,每个格子可以涂黑色或白色,有的格子必须涂黑色 问最大白色正方形边长分别为0,1,2,- ...
- hdu 5903 Square Distance
这题题解dp不懂 因为不知道它怎么记录dp的答案的 字符串那么长 我是贪心过得,当时还被四个人hack,都没成功,hhhhh 大意就是优先从头取字典序小的字母,担也要让后面不管怎么取都合法 #incl ...
- HDU 1518 Square
dfs+剪枝. AC代码例如以下: ///dfs+剪枝 62MS 300K#include<iostream> #include<cstring> #include<al ...
- 杭电OJ分类题目(1)
原题出处:HDOJ Problem Index by Type,http://acm.hdu.edu.cn/typeclass.php 杭电OJ分类题目(1) HDU Introduction HDU ...
最新文章
- echart 多柱图只显示部分数据标签_2分钟上手、3小时学会无代码软件开发---Echarts数据可视化...
- Linux命令查看服务器信息
- JAVA SE学习day16:reflect
- 这几种程序员前途无量!你在其中吗?
- PHP7 ini 配置大全
- 在 Mac OS X Lion 下修改 Hosts 的四种方法
- 防止电子邮件地址被搜索到的新方法
- 验证内容是否为空的多种办法 1210 c#
- 经典算法详解 之 递归算法
- kafka消费者分区消费策略
- python的字符串包括哪些_python怎么判断字符串是否包含某些字符
- angular移除事件绑定事件绑定_002-js的三种事件绑定方式
- 画PCB开始前的准备工作
- 词汇的积累 —— 同义反复、写景状物
- jquery的快捷手册
- Rust : Pointer......to be continued
- 优锘|ThingJS-X零代码平台:七大智慧场景全新Demo
- 抖音小程序微信支付php,抖音头条小程序微信支付开通绑定最全教程!
- 好看的滚动条样式,css实现好看的滚动条样式
- Excel表格中输入一个姓,就可以选择输入需要的姓名了