题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2082
本以为和dfs那道一样,但超时了
照着模板用母函数做,要记得初始化
参考资料:
1、母函数原理+模板代码
2、母函数讲解+AC代码+注释
3、母函数模板代码+母函数AC代码+DP AC代码
#include <iostream>
#include <string.h>
using namespace std;
const int maxn=51; //多项式最大指数
int c1[maxn]; //保存【当前结果多项式】
int c2[maxn]; //保存【中间变量多项式】
int main()
{
int n;
cin>>n;
int num[27];
while(n--)