SGU 506.Subsequences Of Substrings
求一个串S有多少子串subS满足s是subS的子序列.len(S)<=100000, len(s)<=100
直接扫一遍...
--------------------------------------------------------------------
--------------------------------------------------------------------
506. Subsequences Of Substrings
Memory limit: 262144 kilobytes
output: standard
Andrew has just made a breakthrough in steganography: he realized that one can hide a message in a bigger text by making the message a subsequence of the text. We remind that a strings is called a subsequence of string t if one can remove some (possibly none) letters from t and obtain s. Andrew has prepared a text (represented by a string) with a hidden message (represented by another string which is a subsequence of the first string). But it turns out that he doesn't have enough space to write the text, so he wonders if he can remove some letters from the beginning and/or the end of his text in such a way that the hidden message still stays a subsequence of it. You should find out how many ways are there to remove some (possibly none) letters from the beginning of the given text and some (possibly none) letters from the end of the given text in such a way that the given message is a subsequence of the remaining string. Two ways are distinct if the number of letters removed from the beginning or from the end or both are distinct, even if the resulting string is the same.
The first line of the input file contains the text — a non-empty string of lowercase English letters, no more than
letters long. The second line of the input file contains the message — a non-empty string of lowercase English letters, no more than 100 letters long. It is guaranteed that the message is a subsequence of the given text.
Output one integer — the sought number of ways.
sample input |
sample output |
abraaadabraa baa |
23 |
SGU 506.Subsequences Of Substrings的更多相关文章
- Subsequences in Substrings Kattis - subsequencesinsubstrings (暴力)
题目链接: Subsequences in Substrings Kattis - subsequencesinsubstrings 题目大意:给你字符串s和t.然后让你在s的所有连续子串中,找出这些 ...
- SGU题目总结
SGU还是个不错的题库...但是貌似水题也挺多的..有些题想出解法但是不想写代码, 就写在这里吧...不排除是我想简单想错了, 假如哪位神犇哪天发现请告诉我.. 101.Domino(2015.12. ...
- SDU暑期集训排位(4)
SDU暑期集训排位(4) C. Pick Your Team 题意 有 \(n\) 个人,每个人有能力值,A 和 B 轮流选人,A 先选,B 选人按照一种给出的优先级, A 可以随便选.A 想最大化己 ...
- [LeetCode] Count Different Palindromic Subsequences 计数不同的回文子序列的个数
Given a string S, find the number of different non-empty palindromic subsequences in S, and return t ...
- Kattis之旅——Divisible Subsequences
Given a sequence of positive integers, count all contiguous subsequences (sometimes called substring ...
- Codeforces Round #506 (Div. 3) 题解
Codeforces Round #506 (Div. 3) 题目总链接:https://codeforces.com/contest/1029 A. Many Equal Substrings 题意 ...
- [LeetCode] 730. Count Different Palindromic Subsequences 计数不同的回文子序列的个数
Given a string S, find the number of different non-empty palindromic subsequences in S, and return t ...
- codeforces 597C C. Subsequences(dp+树状数组)
题目链接: C. Subsequences time limit per test 1 second memory limit per test 256 megabytes input standar ...
- PIC12F508/505/509/510/506/519/526/527单片机破解芯片解密方法!
IC芯片解密PIC12F508/505/509/510/506/519/526/527单片机破解 单片机芯片解密型号: PIC12F508解密 | PIC12F505解密 | PIC12F506解密 ...
随机推荐
- skiing(搜索+记忆化搜索)
skiing 时间限制:3000 ms | 内存限制:65535 KB 难度:5 描述 Michael喜欢滑雪百这并不奇怪, 因为滑雪的确很刺激.可是为了获得速度,滑的区域必须向下倾斜,而且当 ...
- google自定义站内搜索
ttps://www.google.com/cse/docs/cref.html?hl=zh-cn 重要表单参数: action 字段:您希望存储结果的网址(在该例中,我们使用 http://www. ...
- Coroutine,你究竟干了什么?
一 引子 使用Unity已经有一段时间了,对于Component.GameObject之类的概念也算是有所了解,而脚本方面从一开始就选定了C#,目前来看还是挺明智的:Boo太小众,而且支持有限:JS( ...
- HDU1506_Largest Rectangle in a Histogram
Largest Rectangle in a Histogram Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 ...
- 3种SQL语句分页写法
在开发中经常会使用到数据分页查询,一般的分页可以直接用SQL语句分页,当然也可以把分页写在存储过程里,下面是三种比较常用的SQL语句分页方法,下面以每页5条数据,查询第3页为例子: 第一种:使用not ...
- SharePoint2010 Form验证配置流程
1.修改管理中心的Web.config文件,位置:C:\inetpub\wwwroot\wss\VirtualDirectories\42903 2.修改应用程序的Web.config文件,位置:C: ...
- mysql存储过程和触发器的应用
***********[mysql 存储过程和触发器 -- 别安驹]********************* 1.什么情况下使用存储过程? 完成一些比较麻烦的逻辑,比如多表在mysql端的cpu很空 ...
- poj2478--欧拉函数打表
此题中对时间有要求,如直接使用欧拉函数求解,每输入一个n,就得进行循环求出<n的每个数的欧拉函数, 这样会超时, 于是我们可预先将欧拉函数打表, 再进行一个循环加法运算,便可不超时得解. #in ...
- 出现java.lang.NoSuchFieldException resourceEntries错误的解决方法
JSP表单里面的表单输入<input type= "text" name="user">这里面的每一个输入都是一个Attribute,相当于setA ...
- Linux计划任务(转载)
Linux计划任务(转载) Linux的计划任务是系统管理方面的一个重要内容,是系统自动完成工作的一种实现方式,正因为有了计划任务,我们才可以完全实现系统管理的脚本化和自动化. 关于计划任务,Linu ...