随笔分类 - 字符串—入门题
摘要:You are given two strings 𝑠s and 𝑡t, both consisting of lowercase English letters. You are going to type the string 𝑠s character by character, from
阅读全文
摘要:Codeforces Round #750 (Div. 2) A. Luntik and Concerts c要么为奇数要么为偶数,同时a和b都大于1,如果c为奇数的话拿出一个1一个2就可以把所有的3都平均分了,如果是偶数的话所有的3能直接平均分。同理再把b尽力平均分掉... #include <i
阅读全文
摘要:链接:https://ac.nowcoder.com/acm/contest/11255/C 来源:牛客网 题目描述 Let LCS(s1,s2)LCS(s1,s2) denote the length of the longest common subsequence (not necessary
阅读全文
摘要:链接:https://ac.nowcoder.com/acm/contest/11213/B 来源:牛客网 题目描述 给定22个由小写字母和问号组成的字符串aa与bb,问号代表你想要的任何字符。 请你找出最短的字符串ss,要求ss包含aa和bb两个字符串,你只需要输出ss的长度即可。 输入描述: 第
阅读全文
摘要:AquaMoon had 𝑛n strings of length 𝑚m each. 𝑛n is an odd number. When AquaMoon was gone, Cirno tried to pair these 𝑛n strings together. After makin
阅读全文
摘要:链接:https://ac.nowcoder.com/acm/contest/11233/B 来源:牛客网 题目描述 给出一个仅包含 a,b 的字符串 A。在 A 中间任意位置(包括开头结尾)插入一个字符,最大化 aab 作为子序列(可以不连续)在 A 中出现的次数。 输入描述: 第一行一个仅包含
阅读全文
摘要:Let's define the cost of a string 𝑠s as the number of index pairs i and j (1≤i<j<|s|) such that si=sj and si+1=sj+1. You are given two positive integ
阅读全文
摘要:给你一个字符串表达式 s ,请你实现一个基本计算器来计算并返回它的值。 整数除法仅保留整数部分。 示例 1: 输入:s = "3+2*2" 输出:7 示例 2: 输入:s = " 3/2 " 输出:1 示例 3: 输入:s = " 3+5 / 2 " 输出:5 这个题实际上考的是字符串处理。。。 对
阅读全文
摘要:https://ac.nowcoder.com/acm/contest/9981#question A. 串 考虑先搞出来一个串然后逐渐添加。设dp[i]为长度为i的含有us子串的串的个数,则当dp[i - 1]已经求出来的情况下,第i个位置: 前面已经有us,第i个位置随便添加 dp[i] +=
阅读全文
摘要:链接:https://ac.nowcoder.com/acm/contest/9925/M 来源:牛客网 题目描述 Your git project (you don't need to be familiar with git to solve this problem) has some fil
阅读全文
摘要:In an edge-weighted tree, the xor-length of a path p is defined as the xor sum of the weights of edges on p: ⊕ is the xor operator. We say a path the
阅读全文
摘要:在给定的 N 个整数 A1,A2,…,AN 中选出两个进行异或运算,得到的结果最大是多少? Input 第一行一个整数 N。 第二行 N 个整数 Ai。 Output 一个整数表示答案。 Example 样例输入 5 2 9 5 7 0 样例输出 14 Hint 对于 100%100% 的数据,1≤
阅读全文
摘要:给定N个字符串S1,S2…SNS1,S2…SN,接下来进行M次询问,每次询问给定一个字符串T,求S1S1~SNSN中有多少个字符串是T的前缀。 输入字符串的总长度不超过106106,仅包含小写字母。 输入格式 第一行输入两个整数N,M。 接下来N行每行输入一个字符串SiSi。 接下来M行每行一个字符
阅读全文
摘要:https://ac.nowcoder.com/acm/contest/5758#description 做的迟了+只会水题.jpg 剩下的咕咕咕慢慢补 A. 题目描述 这里有一棵树,每个点和每条边都存在一个价值。对于树上点对的价值,包括点对的起点和终点以及路径上边权值之和,不包括路径上其他点值。
阅读全文
摘要:Word ss of length nn is called kk -complete if ss is a palindrome, i.e. si=sn+1−isi=sn+1−i for all 1≤i≤n1≤i≤n ; ss has a period of kk , i.e. si=sk+isi
阅读全文
摘要:You are given a string ss consisting of lowercase Latin letters. Let the length of ss be |s||s| . You may perform several operations on this string. I
阅读全文
摘要:Bessie the cow has just intercepted a text that Farmer John sent to Burger Queen! However, Bessie is sure that there is a secret message hidden inside
阅读全文
摘要:Returning back to problem solving, Gildong is now studying about palindromes. He learned that a palindrome is a string that is the same as its reverse
阅读全文