1513专题

HDU-1513 Palindrome LCS+滚动数组

/*http://acm.hdu.edu.cn/showproblem.php?pid=1513将原字符串倒置,然后与原字符串求最长公共子序列,答案就是len-dp[len][len]。*/#include "stdio.h"#include "string.h"const int maxn = 510;int n;char str1[maxn],str2[maxn];int d

杭电1513(Palindrome)

点击打开杭电1513 Problem Description A palindrome is a symmetrical string, that is, a string read identically from left to right as well as from right to left. You are to write a program which, given a

UVa 1513 / UVALive 5902 Movie collection (树状数组)

1513 - Movie collection Time limit: 3.000 seconds http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=448&page=show_problem&problem=4259 https://icpcarchive.

树上的回文 51Nod - 1513

https://www.51nod.com/onlineJudge/questionCode.html#!problemId=1513 对每层的点分别按dfs序中的位置排序 然后对每个字母搞一个前缀和 对每个查询 找出该点在dfs序上对应区间的左右端点 在给定层上二分一下即可 #include <bits/stdc++.h>using namespace std;#define pb pu

力扣1513-仅含 1 的子串数-No.2-2021

class Solution {public int numSub(String s) {String[] sub=s.split("0");long total=0;long a=0;for(int i=0;i<sub.length;i++){a=(long)sub[i].length();total=total+a*(a+1)/2;}return (int)(total%(1000000000

Palindrome HDU - 1513(LCS 滚动数组)

Palindrome HDU - 1513题意:给出一个字符串, 要求插入最少的字符使得该串成为回文串;对给出串和它的反转串求一遍LCS, 串的长度减去LCS就是答案;注意要用滚动数组, 否则会超内存; #include <cstdio>#include <cstring>#include <iostream>#include <algorithm>using namespace s