摘要:
因为马拉车不能求回文子序列个数,所以只能采用这个DP 此DP是不要求连续的回文子串 你要连续的回文子串个数,可以用回文自动机 #include <iostream> using namespace std; int dp[200][200]; string str; int solve(){ int 阅读全文
posted @ 2024-04-17 23:12
涤生yang
阅读(14)
评论(0)
推荐(0)
摘要:
直接上板子 直接输出最长回文子序列的长度 #include<bits/stdc++.h> using namespace std; const int maxl=1100005; int p[32000005]; //p[i]-1表示以i为中点的回文串长度,这个数组要大 string a; //用于 阅读全文
posted @ 2024-04-17 22:31
涤生yang
阅读(20)
评论(0)
推荐(0)
摘要:
求n的p次方,对M的取模 递归: #define M 10003 int PowMod(int n, int p) { if (p == 1) { return n % M; } int temp = Pow(n, p/2); int result = (temp*temp) % M; if (p 阅读全文
posted @ 2024-04-17 10:42
涤生yang
阅读(21)
评论(0)
推荐(0)

浙公网安备 33010602011771号