题目链接: Subsequences in Substrings Kattis - subsequencesinsubstrings 题目大意:给你字符串s和t.然后让你在s的所有连续子串中,找出这些连续子串中的非连续子串中包含t的有多少个. 具体思路:我们枚举s的每一个位置,然后判断一下s的包含t的非连续子串中到达那个位置,然后这个字符串两边的长度相乘就是当前位置开始,满足条件的字符位置.然后我们在找从上一次找到首字母位置下一个开始, 继续往下找就可以了. AC代码: #include<bit…
求一个串S有多少子串subS满足s是subS的子序列.len(S)<=100000, len(s)<=100 直接扫一遍... -------------------------------------------------------------------- #include<cstdio> #include<cstring> #include<algorithm>   using namespace std;   typedef long long…
SGU还是个不错的题库...但是貌似水题也挺多的..有些题想出解法但是不想写代码, 就写在这里吧...不排除是我想简单想错了, 假如哪位神犇哪天发现请告诉我.. 101.Domino(2015.12.16) 102.Coprimes 求φ(N). 1<=N<=10^4 按欧拉函数的公式直接算..O(N^0.5)(2015.12.16) #include<cstdio> #include<cstring> #include<algorithm> using n…
◇赛时·V◇ Codeforces Round #486 Div3 又是一场历史悠久的比赛,老师拉着我回来考古了……为了不抢了后面一些同学的排名,我没有做A题 ◆ 题目&解析 [B题]Substrings Sort +传送门+   [暴力模拟] 题意 给出n个字符串,你需要将它们排序,使得对于每一个字符串,它前面的字符串都是它的子串(对于字符串i,则字符串 1~i-1 都是它的子串). 解析 由于n最大才100,所以 O(n3) 的算法都不会爆,很容易想到暴力模拟. 如果字符串i是字符串j的子串…
SDU暑期集训排位(4) C. Pick Your Team 题意 有 \(n\) 个人,每个人有能力值,A 和 B 轮流选人,A 先选,B 选人按照一种给出的优先级, A 可以随便选.A 想最大化己方能力值. 做法 划分方案合法的充要条件:任何前缀中,\(被 B 选择的人 - 被 A 选择的人 > -1\) 考虑 DP,\(dp[i][j]\) 表示考虑前 \(i\) 个人,\(j\) 个人被 B 选择了,A 和 B 最大分差. 考虑转移,枚举 \(i+1\) 个人归属即可. D. Piece…
Given a sequence of positive integers, count all contiguous subsequences (sometimes called substrings, in contrast to subsequences, which may leave out elements) the sum of which is divisible by a given number. These subsequences may overlap. For exa…
题目链接: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,…
http://acm.hdu.edu.cn/showproblem.php?pid=1238 Substrings Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 65536/32768K (Java/Other) Total Submission(s) : 10   Accepted Submission(s) : 6 Font: Times New Roman | Verdana | Georgia Font Size: ← →…
试题 算法提高 Substrings 问题描述 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. 输入格式 The first line of the input…
Problem 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…