20160329 HDU2082 找单词(生成函数)
来源:互联网 发布:淘宝如何举报卖家售假 编辑:程序博客网 时间:2024/06/06 08:19
运用生成函数求对于有权值的多个堆,每个对应的权值有多少种组合方法。
#include <iostream>#include <string.h>using namespace std;int main(){ int T; int inp[100]; long long c1[100],c2[100]; cin>>T; while(T--) { for(int i=1;i<=26;i++) cin>>inp[i]; memset(c1,0,sizeof(c1)); memset(c2,0,sizeof(c2)); for(int i=0;i<=inp[1];i++) c1[i]=1; for(int i=2;i<=26;i++) { for(int j=0;j<=inp[i];j++) { for(int k=0;k<=51;k++) { int c=k+i*j; if(c>=51) c=51; c2[c]+=c1[k]; } } for(int j=0;j<=50;j++) c1[j]=c2[j]; memset(c2,0,sizeof(c2)); } long long ans=0; for(int i=0;i<=50;i++) ans+=c1[i]; cout<<ans-1<<endl; } return 0;}
0 0
- 20160329 HDU2082 找单词(生成函数)
- hdu2082找单词(母函数)
- hdu2082 找单词(母函数)
- hdu2082找单词(母函数)
- HDU2082 找单词 【母函数】
- hdu2082找单词(母函数)
- hdu2082 找单词 (母函数)
- hdu2082 找单词 母函数
- HDU2082 找单词(背包)
- hdu2082找单词(背包)
- HDU2082找单词(母函数模板题)
- 母函数——找单词(hdu2082)
- hdu2082找单词——母函数
- hdu2082 找单词 (背包dp)
- hdu2082-找单词
- HDU2082 找单词
- hdu2082 找单词
- hdu2082找单词
- mybatis报org.apache.ibatis.reflection.ReflectionException: Error instantiating null with invalid type
- 流水灯实验
- Spark 基础 —— RDD(一)
- 使用Asset Catalog 的Slicing的功能
- OC内存管理常见面试题整理
- 20160329 HDU2082 找单词(生成函数)
- 在一个字符串中求出 大写字母的个数,小写字母的个数,及非英文字母数
- http协议状态码和web错误解决总结
- bzoj 2157(link cut tree)
- 【C++】内存的那些事儿
- Java Socket的TCP编程的简单总结
- BZOJ_P4199 [NOI2015] 品酒大会(后缀数组+并查集)
- 微信样式相册选择器
- BroadcastReceive基础知识总结