[BZOJ4259]残缺的字符串
残缺的字符串
题解
其实大部分字符串的题都可以用多项式来想,包括这道题。
于是,我们可以尝试去构造两个多项式,使其乘后的系数为0即可。
相等为0,那么我们可以用减法表示。
可‘*’可以匹配所有的符号,我们又该咋办?那不就相当于乘个0嘛。
于是,我们得到了下式:。
然后就可以卷积计算了。
源码
#include<cstdio>
#include<cmath>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<queue>
#include<vector>
#include<map>
using namespace std;
typedef long long LL;
#define int LL
#define gc() getchar()
template<typename _T>
void read(_T &x){
_T f=1;x=0;char s=gc();
while(s>'9'||s<'0'){if(s=='-')f=-1;s=

浙公网安备 33010602011771号