题目链接:https://vjudge.net/problem/POJ-1226 Substrings Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 15122 Accepted: 5309 Description You are given a number of case-sensitive strings of alphabetic characters, find the largest string X,…
Description You are given a number of case-sensitive strings of alphabetic characters, find the largest string X, such that either X, or its inverse can be found as a substring of any of the given strings. Input The first line of the input contains a…
Given a string and a string dictionary, find the longest string in the dictionary that can be formed by deleting some characters of the given string. If there are more than one possible results, return the longest word with the smallest lexicographic…
1.给出任意一个字符串,打印一个最长子串字符串及其长度,如果有相同长度的子字符串,都要一起打印出来,该子字符串满足以下条件, 第一个字母和最后一个字符是第一次重复 这个子字符串的中间字母没有重复 这个子字符串是满足条件里面的最长的 如: adsasadmasd 中满足条件的是dmasd import re def maxsubstring(s): res_list=[] max_len=0 for i in range(len(s)): index=s[i+1:].find(s[i]) if i…
Given a string and a string dictionary, find the longest string in the dictionary that can be formed by deleting some characters of the given string. If there are more than one possible results, return the longest word with the smallest lexicographic…
A. Magic Numbers time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output A magic number is a number formed by concatenation of numbers 1, 14 and 144. We can use each of these numbers any number of…
只需要鉴别这些类型那么使用typeof即可,要鉴别null先判断双等判断是否为null,之后使用typeof判断,如果是obejct的话,再用Array.isArray判断是否为数组,如果是数字再使用isNaN判断是否为NaN,(需要注意的是NaN并不是JavaScript数据类型,而是一种特殊值)代码如下: function type(ele) { if (ele === null) { return null; } else if (typeof ele === 'object') { if…
Long Long Message Time Limit: 4000MS Memory Limit: 131072K Total Submissions: 25752 Accepted: 10483 Case Time Limit: 1000MS Description The little cat is majoring in physics in the capital of Byterland. A piece of sad news comes to him these days…
传送门 后缀自动机基础题. 给出10个串求最长公共子串. 我们对其中一个建一个samsamsam,然后用剩下九个去更新范围即可. 代码: #include<bits/stdc++.h> #define ri register int using namespace std; const int N=2e5+5; int T=0,n; char s[N]; struct SAM{ int rt,tot,last,len[N],lz[N],cnt[N],rk[N],val[N],link[N],s…
后缀数组之前一直在给队友搞,但是这个类太大了,预感到青岛八成会有,于是自己也学习一下,记录一下做题的历程 所用的模板暂时来自于队友的倍增nlogn da算法 int t1[maxn] , t2[maxn] , c[maxn] ; bool cmp(int *r , int a , int b , int l) { return r[a] == r[b] && r[a+l] == r[b+l] ; } void da(int s[], int sa[], int ra[], int he[]…