ICode9

精准搜索请尝试: 精确搜索
  • F. Rotating Substrings(dp)2020-06-04 09:03:15

    F. Rotating Substrings(dp) 思路:dpdpdp,找到最大匹配数然后用nnn去减,因为每个字母最多动一次就行了。 设dp[i][j]dp[i][j]dp[i][j]为SSS串中前iii个字符和TTT串中前jjj个字符的最大匹配。 转移状态时注意因为每次操作字符往左移动,所以必须满足i≤ji\leq ji≤j,不然永远匹配不

  • CodeForces 1270F Awesome Substrings2020-05-29 10:03:01

    CodeForces 1270F Awesome Substrings https://codeforces.com/contest/1270/problem/F 给出一个01串 \(s\) ,求 \(s\) 有多少个非空子串满足,其中有至少一个'1',且'1'的数量是子串长度的约数. \(1 \le |s| \le 200000\) Tutorial 设 \(n=|s|\) ,设 \(pre(i)\) 表示 \(s\) 中前 \(

  • C. Yet Another Broken Keyboard--------思维2020-01-28 15:40:06

    Recently, Norge found a string s=s1s2…sn consisting of n lowercase Latin letters. As an exercise to improve his typing speed, he decided to type all substrings of the string s. Yes, all n(n+1)2 of them! A substring of s is a non-empty string x=s[a…b]=

  • Substrings2020-01-26 16:06:51

    SP8222 You are given a string S which consists of 250000 lowercase latin letters at most. We define F(x) as the maximal number of times that some string with length x appears in S. For example for string ‘ababa’ F(3) will be 2 because there is a stri

  • [Leetcode]647.Palindromic Substrings2020-01-22 09:00:38

    链接:LeetCode647 给定一个字符串,你的任务是计算这个字符串中有多少个回文子串。 具有不同开始位置或结束位置的子串,即使是由相同的字符组成,也会被计为是不同的子串。 示例 1: 输入: "abc" 输出: 3 解释: 三个回文子串: "a", "b", "c". 示例 2: 输入: "aaa" 输出: 6 说明: 6个回文

  • 【leetcode】1316. Distinct Echo Substrings2020-01-12 19:57:30

    题目如下: Return the number of distinct non-empty substrings of text that can be written as the concatenation of some string with itself. Example 1: Input: text = "abcabcabc" Output: 3 Explanation: The 3 substrings are "abcabc", "bca

  • @codeforces - 1276F@ Asterisk Substrings2019-12-24 19:54:26

    目录 @description@ @solution@ @accepted code@ @details@ @description@ 给定一个包含 n 个小写字母的字符串 s,用 s 生成 n 个串 t1...n,其中 ti 等于字符串 s 将第 i 个字符替换为 * 得到的字符串。 特别注意:这里的 * 只是一个字符,并不具有其他含义(如通配符)。 求有多少字

  • codeforce A. Many Equal Substrings2019-10-20 23:54:58

      http://codeforces.com/contest/1029/problem/A   嗳,简单的题做起来是真的舒服qwq   1 public static void main(String[] args) { 2 Scanner io=new Scanner(System.in); 3 int n=io.nextInt(),k=io.nextInt(); 4 String str=io.nextLine(); 5

  • String(hdu 4821 字符串Hash+Map)2019-10-18 16:01:16

    String Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 5324    Accepted Submission(s): 1582 Problem Description Given a string S and two integers L and M, we consider a substring of S as “recove

  • Leetcode: Palindromic Substrings2019-09-30 14:01:42

    647. Palindromic SubstringsMedium165685FavoriteShareGiven a string, your task is to count how many palindromic substrings in this string.The substrings with different start indexes or end indexes are counted as different substrings even they consist of sa

  • 校内训练赛9 Repeated Substrings(后缀数组)2019-08-27 21:01:12

    文章目录Repeated Substrings (二分+后缀数组)题目链接题意:思路:代码: Repeated Substrings (二分+后缀数组) 题目链接 题意: 给定一个字符串 S(∣S∣<=1e5)S (|S|<=1e5)S(∣S∣<=1e5) ,要求找到一个最长的子串,并且这个子串出现不止一次,可以重叠。 有多个最长子串则输出字典序最小。

  • HDU4821(hash+map)2019-08-16 11:39:39

    题目:Given a string S and two integers L and M, we consider a substring of S as “recoverable” if and only if (i) It is of length M*L; (ii) It can be constructed by concatenating M “diversified” substrings of S, where each of these substrings has len

  • 【SPOJ】Distinct Substrings2019-07-31 19:57:23

    题面 https://vjudge.net/problem/SPOJ-DISUBSTR 题解 #include<cstdio>#include<iostream>#include<cstring>#define ri int#define N 1050using namespace std;int n,T;char s[N];struct node{ int ff,len; int ch[26];} t[N<<1];int tot,last; voi

  • POJ 3415 Common Substrings(后缀数组+单调队列)2019-07-28 21:04:14

    题目链接:http://poj.org/problem?id=3415 后缀数组论文链接:https://wenku.baidu.com/view/5b886b1ea76e58fafab00374.html 解题思路: 求不小于k的最长公共子串的数量。 ① 首先连接两个字符串A,B,构造后缀和height数组,我们按照k,将height>=k的分在一起,属于这一堆内的后缀,只有可能

  • leetcode 1016. 子串能表示从 1 到 N 数字的二进制串(Binary String With Substrings Representing 1 To N)2019-05-30 15:42:25

    目录 题目描述: 示例 1: 示例 2: 解法: 题目描述: 给定一个二进制字符串 S(一个仅由若干 '0' 和 '1' 构成的字符串)和一个正整数 N,如果对于从 1 到 N 的每个整数 X,其二进制表示都是 S 的子串,就返回 true,否则返回 false。 示例 1: 输入:S = "0110", N = 3 输出:true 示例 2: 输入:S = "011

  • #Leetcode# 1016. Binary String With Substrings Representing 1 To N2019-04-13 09:37:38

    https://leetcode.com/problems/binary-string-with-substrings-representing-1-to-n/   Given a binary string S (a string consisting only of '0' and '1's) and a positive integer N, return true if and only if for every integer X from 1 to N,

  • Subsequences in Substrings Kattis - subsequencesinsubstrings (暴力)2019-04-08 20:43:19

    题目链接: Subsequences in Substrings  Kattis - subsequencesinsubstrings  题目大意:给你字符串s和t。然后让你在s的所有连续子串中,找出这些连续子串中的非连续子串中包含t的有多少个。 具体思路:我们枚举s的每一个位置,然后判断一下s的包含t的非连续子串中到达那个位置,然后这个字

  • SPOJ Distinct Substrings SA2019-04-05 08:55:13

    正解:SA 解题报告: 传送门! 啊先给个翻译趴QwQ大概就是说给个字符串,求互不相等的子串的个数 算是道小水题辣趴,,,并不难想到的呢QAQ只是因为是新知识所以巩固下而已QAQ 然后就显然考虑合法方案就会是所有方案-不合法方案 所有方案显然是n*(n+1)/2,不合法方案就是相等的子串的个数

  • SP694 DISUBSTR - Distinct Substrings2019-03-25 20:53:29

    /* 统计每个节点的max和min, 然后求和即可 min = max[fa] + 1 */ #include<cstdio> #include<algorithm> #include<iostream> #include<cstring> #include<queue> #define ll long long #define M 6010 #define mmp make_pair using namespace std; int re

  • CodeForces Round #548 Div22019-03-25 13:50:46

    http://codeforces.com/contest/1139   A. Even Substrings   You are given a string s=s1s2…sns=s1s2…sn of length nn, which only contains digits 11, 22, ..., 99. A substring s[l…r]s[l…r] of ss is a string slsl+1sl+2…srslsl+1sl+2…sr. A substring

  • [Swift]LeetCode696. 计数二进制子串 | Count Binary Substrings2019-03-09 19:43:04

    Give a string s, count the number of non-empty (contiguous) substrings that have the same number of 0's and 1's, and all the 0's and all the 1's in these substrings are grouped consecutively. Substrings that occur multiple times are co

  • codeforces1110H Modest Substrings2019-02-22 13:49:16

    题面 题意 给出三个数l,r,nl,r,nl,r,n,求出一个由数字组成的字符串,使其所有子串中,符合在[l,r][l,r][l,r]内的数量最多,若有多组解,输出字典序最小的一个。 做法 首先考虑最朴素的做法,可以将[l,r]内的所有数字当作字符串加入一个AC自动机,直接在上面dp。 但是因为l和r极大,因此需要

  • CodeForces 1110H. Modest Substrings2019-02-18 11:39:20

    题目简述:给定$1 \leq l \leq r \leq 10^{800}$,求一个长度为$n \leq 2000$的数字串$s$,其含有最多的子串$s[x \dots y]$,将其看做数字时无前导零且满足$l \leq s[x \dots y] \leq r$。形式化的说,就是求 $$ \arg \max_{s \in \Sigma^n} \sum_{i=1}^n \sum_{j=i}^n [s[i] \neq 0 \land l

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有