题目大意:有面值分别为。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的更多相关文章

  1. hdu 1398 Square Coins 分钱币问题

    Square Coins Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit ...

  2. 题解报告:hdu 1398 Square Coins(母函数或dp)

    Problem Description People in Silverland use square coins. Not only they have square shapes but also ...

  3. hdu 1398 Square Coins (母函数)

    Square Coins Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Tota ...

  4. hdu 1398 Square Coins(简单dp)

    Square Coins Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Pro ...

  5. hdu 1398 Square Coins(生成函数,完全背包)

    pid=1398">链接:hdu 1398 题意:有17种货币,面额分别为i*i(1<=i<=17),都为无限张. 给定一个值n(n<=300),求用上述货币能使价值 ...

  6. HDU 1398 Square Coins 整数拆分变形 母函数

    欢迎参加——BestCoder周年纪念赛(高质量题目+多重奖励) Square Coins Time Limit: 2000/1000 MS (Java/Others)    Memory Limit ...

  7. 杭电ACM hdu 1398 Square Coins

    Problem Description People in Silverland use square coins. Not only they have square shapes but also ...

  8. HDU 1398 Square Coins(母函数或dp)

    Square Coins Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Tota ...

  9. HDU 1398 Square Coins(DP)

    Square Coins Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Tota ...

随机推荐

  1. 解决Collection <__NSArrayM: 0x7f8168f7a750> was mutated while being enumerated.'

    当程序出现这个提示的时候,是因为你一边便利数组,又同时修改这个数组里面的内容,导致崩溃,网上的方法如下: NSMutableArray * arrayTemp = xxx; NSArray * arr ...

  2. android操作ini工具类

    package com.smarteye.common; import java.io.BufferedReader; import java.io.BufferedWriter; import ja ...

  3. A - 数塔

    A - 数塔 Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Statu ...

  4. linux杂记(六)档案权限

    [KANO@kelvin ~]$ ls -al 总用量 drwx------. KANO KANO 10月 : . drwxr-xr-x. root root 9月 : .. drwxrwxr-x. ...

  5. linux杂记(十)what is BASH Shell

    first,what is shell?其实只要是碰过计算机的,对于OS(Operation System操作系统,不管是linux.unix.windows)有点概念的人大多都听过这个名词,因为只要 ...

  6. java之适配器模式

    interface Window {     public void open();     public void close();     public void activated();     ...

  7. C#学习日志 day 2 plus ------ hyper-V 开启方法

    hyper-V的开启需要两个步骤. 第一是在bios中开启 virtualization technology--虚拟化技术 在process setting中改为enabled. 进入bios界面的 ...

  8. vc6.0批量编译

    一直想研究一下怎么让电脑批处理编译程序,今天就从vc6开始,做个记录,学习一下. VC可以生成make文件(Project->Export Makefile),在设置好环境变量下,执行NMAKE ...

  9. spring util命名空间

    在spring的配置文件中util命名空间类似于java.util包类对应,util命名空间提供了集合相关的配置,在使用命名空间前要导入util命名空间,如下: util命名空间引入 <bean ...

  10. maven打包成第三方jar包且把pom依赖包打入进来

    <build> <plugins> <plugin> <artifactId>maven-assembly-plugin</artifactId& ...