链接: http://acm.hdu.edu.cn/showproblem.php?pid=2082 题意: 假设有x1个字母A, x2个字母B,..... x26个字母Z,同时假设字母A的价值为1,字母B的价值为2,..... 字母Z的价值为26。那么,对于给定的字母,可以找到多少价值<=50的单词呢?单词的价值就是组成一个单词的所有字母的价值之和,比如,单词ACM的价值是1+3+14=18,单词HDU的价值是8+4+21=33。(组成的单词与排列顺序无关,比如ACM与CMA认为是同一个单词)。 思路: 母函数模板 代码: #include<iostream> #include<cstdio> #include<cstring> #include<string> #include<algorithm> #include<math.h> #include<vector> using namespace std; typedef long long LL; const int INF = 1e9; const int MAXN = 1e5+10; const int MOD = 1e9+7; int cnt[30]; LL Val[100], Tmp[100]; void Init() { memset(Val, 0, sizeof(Val)); Val[0] = 1; for