HDOJ 2082 找单词 (母函数)
找单词
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 2919 Accepted Submission(s): 2089
然后包括N行数据,每行包括26个<=20的整数x1,x2,.....x26.
1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
9 2 6 2 10 2 2 5 6 1 0 2 7 0 2 2 7 5 10 6 10 2 10 6 1 9
379297
//26个字母即26层 每个字母有数量的限制
#include <iostream>
#include <cstdio>
#include <cstring> using namespace std; typedef long long int LL; int main()
{
int ap[];
int T;
scanf("%d",&T);
while(T--)
{
for(int i=;i<=;i++)
{
scanf("%d",&ap[i]);
}
int c1[],c2[];
memset(c1,,sizeof(c1));
memset(c2,,sizeof(c2));
for(int i=;i<=ap[];i++)
{
c1[i]=;c2[i]=;
} for(int i=;i<=;i++)
{
for(int j=;j<=;j++)
{
for(int k=,s=;k+j<=&&s<=ap[i];k+=i,s++)
c2[k+j]+=c1[j];
}
for(int j=;j<=;j++)
{
c1[j]=c2[j]; c2[j]=;
}
} LL ans=;
for(int i=;i<=;i++)
{
ans+=c1[i];
} printf("%I64d\n",ans); } return ;
}
HDOJ 2082 找单词 (母函数)的更多相关文章
- HDU 1028 整数拆分 HDU 2082 找单词 母函数
生成函数(母函数) 母函数又称生成函数.定义是给出序列:a0,a1,a2,...ak,...an, 那么函数G(x)=a0+a1*x+a2*x2+....+ak*xk +...+an* xn 称为序 ...
- HDU 2082 找单词 (普通型 数量有限 母函数)
传送门: http://acm.hdu.edu.cn/showproblem.php?pid=2082 找单词 Time Limit: 1000/1000 MS (Java/Others) Me ...
- hdu2082 找单词 (母函数)
找单词 题意: 中文题,考虑是不是要写个英文题意..(可惜英语水平不够 囧rz) (题于文末) 知识点: 母函数(生成函数): 生成函数有普通型生成函数和指数型生成函数 ...
- hdu acm 2082 找单词
找单词 Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submiss ...
- hdu2082 找单词 母函数模板
找单词 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 找单词 (多重背包)
题意:假设有x1个字母A, x2个字母B,..... x26个字母Z,同时假设字母A的价值为1,字母B的价值为2,..... 字母Z的价值为26.那么,对于给定的字母,可以找到多少价值<=50的 ...
- HDU 2082 找单词
Problem Description 假 设有x1个字母A, x2个字母B,..... x26个字母Z,同时假设字母A的价值为1,字母B的价值为2,..... 字母Z的价值为26.那么,对于给定的字 ...
- HDU 2082 找单词 --生成函数
跟上题是一个思路:http://www.cnblogs.com/whatbeg/p/3728545.html 只不过是上一题的扩展. 代码: #include <iostream> #in ...
随机推荐
- Win10下IIS配置图解、MVC项目发布图解、IIS添加网站图解
Win10下IIS配置 .找到控制面板:[开始]菜单鼠标右击,打开[控制面板] .打开控制面板,点击[程序],点击[启用或关闭Windows功能] 下一步,点击[启用虎关闭Windows功能] . 开 ...
- linux MTD系统解析(转)
MTD,Memory Technology Device即内存技术设备,在Linux内核中,引入MTD层为NOR FLASH和NAND FLASH设备提供统一接口.MTD将文件系统与底层FLASH存储 ...
- EMVTag系列17《9F66 终端交易属性》
字节:1 8 1 – 支持非接触磁条 (MSD) 0– 不支持非接触磁条 (MSD) 7 1 – 支持非接触PBOC 0– 不支持非接触PBOC 6 1 – 支持非接触qPBOC 0 ...
- [Letcode] 1. Two Sum
Given an array of integers, return indices of the two numbers such that they add up to a specific ta ...
- poj 3625 Building Roads
题目连接 http://poj.org/problem?id=3625 Building Roads Description Farmer John had just acquired several ...
- hdu 2579 Dating with girls(2)
题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=2579 Dating with girls(2) Description If you have sol ...
- Tutorial: Facebook analytics using Power BI Desktop
In this tutorial you learn how to import and visualize data from Facebook. During the tutorial you'l ...
- 使用IC框架开发跨平台App的备忘录123
1,关于图标与启动屏幕 icon.png 192x192splash.png 2208x2208 将这两个图片放在resources目录下,在终端执行:ionic resources --iocn - ...
- 怎么解决/bin/sh: arm-linux-gcc: not found make
1.arm-linux-gcc 环境变量没有设,所以找不到这个编译器 在/etc/profile里添加arm-linux-gcc的存放路径 sudo -s gedit /etc/profile 编 ...
- go语言示例-Timer计时器的用法
计时器用来定时执行任务,分享一段代码: package main import "time" import "fmt" func main() { //新建计时 ...