HDU 2082 母函数法
#include <cstdio>
#include <cstring> using namespace std; int cnt[] , dp[][]; int main()
{
// freopen("a.in" , "r" , stdin);
int T;
scanf("%d" , &T);
while(T--){
for(int i= ; i<= ; i++)
scanf("%d" , cnt+i); memset(dp , , sizeof(dp));
dp[][] = ;
for(int i= ; i<= ; i++){
for(int j= ; j<=cnt[i] ; j++){
if(i*j > ) break;
for(int k=-i*j ; k>= ; k--){
dp[i][i*j+k] += dp[i-][k];
}
}
}
int ans = ;
for(int i = ; i<= ; i++)
ans += dp[][i];
printf("%d\n" , ans);
}
return ;
}
HDU 2082 母函数法的更多相关文章
- HDU 2082 母函数模板题
找单词 Time Limit: 1000MS Memory Limit: 32768KB 64bit IO Format: %I64d & %I64u Submit Status De ...
- hdu 1028 母函数 一个数有几种相加方式
///hdu 1028 母函数 一个数有几种相加方式 #include<stdio.h> #include<string.h> #include<iostream> ...
- HDU 2082 找单词 (普通型 数量有限 母函数)
传送门: http://acm.hdu.edu.cn/showproblem.php?pid=2082 找单词 Time Limit: 1000/1000 MS (Java/Others) Me ...
- HDU 1028 整数拆分 HDU 2082 找单词 母函数
生成函数(母函数) 母函数又称生成函数.定义是给出序列:a0,a1,a2,...ak,...an, 那么函数G(x)=a0+a1*x+a2*x2+....+ak*xk +...+an* xn 称为序 ...
- 组合数学 - 母函数的运用 + 模板 --- hdu : 2082
找单词 Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submiss ...
- HDU 2082 找单词 (普通母函数)
题目链接 Problem Description 假设有x1个字母A, x2个字母B,..... x26个字母Z,同时假设字母A的价值为1,字母B的价值为2,..... 字母Z的价值为26.那么,对于 ...
- 找单词 HDU - 2082(普通母函数)
题目链接:https://vjudge.net/problem/HDU-2082 题意:中文题. 思路:构造普通母函数求解. 母函数: 1 #include<time.h> 2 #incl ...
- HDU 2082 普通型母函数
分析: 组成单词好说,价值如何体现? 改变指数就行,例如: 这样,组成的单词,指数就是权值,多项式相乘,指数小于50的就OK: #include <bits/stdc++.h> using ...
- hdu 2082 生成函数
主题链接:http://acm.hdu.edu.cn/showproblem.php?pid=2082 找单词 Time Limit: 1000/1000 MS (Java/Others) Me ...
随机推荐
- 10.12NOIP模拟题(1)
#include<iostream> #include<cstdio> #include<cstring> #include<queue> #defin ...
- php编译安装参数详解
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/loc ...
- [读书笔记3]《C语言嵌入式系统编程修炼》
第五章 性能优化 5.1 使用宏定义 在C语言中,宏是产生内嵌代码的唯一方法.对于嵌入式系统而言,为了能达到性能要求,宏是一种很好的代替函数的方法. 写一个"标准"宏MIN ...
- Linux C编程 GCC的使用
本篇文章面向一些会linux文件操作与vim基本命令,编程大佬请移步勿喷. gcc是默认安装的,但是其还缺少常用的头文件和库文件,所以还需要build-essential这个包,可以在联网状态下使用如 ...
- F - System Overload(约瑟夫环变形)
Description Recently you must have experienced that when too many people use the BBS simultaneously, ...
- 数据返回(数据共享,即从后端返回到前端调用,四种(requesst、ModelAndView、Model、Map))
@Controller @RequestMapping("/view")//请求父路径 public class GoodsController { @RequestMapping ...
- MySQL的两种存储引擎storage engine特点和对比
MyISAM 优点:快速读取数据, 占用空间小 缺点:不支持事务,外键 (表级别锁) InnoDB 优点:支持事务,外键; 高性能(CPU效率高) 缺点: 慢,占空间 (行级别锁)
- Jax
The scope of this project is to automate the current Credit Correction process of opening, editing, ...
- java项目怎么打jar包(项目中包含第三方jar包)
1,右键选中项目,点击Export导出,找到java,选择第三个Runnable JAR file, 2,在Launch configuration中,填入程序的入口(有main方法的类), 然后 ...
- CF869C The Intriguing Obsession
思路: 分别在两种不同颜色的岛屿群之间进行搭桥.因为相同颜色的岛屿之间不能有边,任意两个相同颜色的岛屿不能同时和另外一个不同颜色的岛屿都有边.实现: #include <bits/stdc++. ...