首页 > 其他 > 详细

序列自动机求回文子序列

时间:2020-04-03 22:19:51      阅读:65      评论:0      收藏:0      [点我收藏+]

直接看程序吧

LL Dfs(LL x,LL y)
{
if(f[x][y]) return f[x][y];
for(LL i=1;i<=a;++i)
if(nxt1[x][i]&&nxt2[y][i]){
if(nxt1[x][i]+nxt2[y][i]>n+1) continue;
if(nxt1[x][i]+nxt2[y][i]<n+1) f[x][y]++;
f[x][y]=(f[x][y]+Dfs(nxt1[x][i],nxt2[y][i]))%mod;
}
return ++f[x][y];
}

  

序列自动机求回文子序列

原文:https://www.cnblogs.com/cutemush/p/12629015.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!