字符串问题
文章平均质量分 82
xuanweiace
一个热爱算法竞赛的弱校ACMer路过。青大本,浙大硕,方向后端开发,菜鸡一枚,奋斗ing...
展开
-
【CodeForces - 514C】Watto and Mechanism(字符串哈希)
题干:输入n个字符串,然后进行m次询问,每次询问输入一个字符串,问n个字符串中是否存在与当前输入的字符串长度相等,并且刚好有且仅有一个位置的字符不同。存在则输出YES,不存在输出NO。ExamplesInput2 3aaaaaacacacaaabaaccacacccaaacOutputYESNONO解题报告: 刚开始读错题了,还以为需要对于每...原创 2019-10-14 19:16:36 · 423 阅读 · 1 评论 -
【51Nod - 1182】完美字符串(贪心,字符串)
题干:约翰认为字符串的完美度等于它里面所有字母的完美度之和。每个字母的完美度可以由你来分配,不同字母的完美度不同,分别对应一个1-26之间的整数。约翰不在乎字母大小写(也就是说字母A和a的完美度相同)。给定一个字符串,输出它的最大可能的完美度。例如:dad,你可以将26分配给d,25分配给a,这样整个字符串完美度为77。Input输入一个字符串S(S的长度 <= 10000)...原创 2018-11-11 21:19:45 · 247 阅读 · 0 评论 -
【CodeForces - 151D】Quantity of Strings (字符串问题,思维推导,有坑)
题干:Just in case somebody missed it: this winter is totally cold in Nvodsk! It is so cold that one gets funny thoughts. For example, let's say there are strings with the length exactly n, based on th...原创 2018-11-21 19:19:01 · 446 阅读 · 0 评论 -
【HihoCoder - 1850】字母去重 (字符串,思维)
题干:给定一个字符串S,每次操作你可以将其中任意一个字符修改成其他任意字符。请你计算最少需要多少次操作,才能使得S中不存在两个相邻的相同字符。Input只包含小写字母的字符串S。 1 ≤ |S| ≤ 100000Output一个整数代表答案Sample InputaabSample Output1解题报告: 考虑对于s[i]字符,如果改...原创 2018-11-19 19:02:46 · 447 阅读 · 3 评论 -
【CH - 1401】 兔子与兔子(字符串哈希)
题干:描述很久很久以前,森林里住着一群兔子。有一天,兔子们想要研究自己的 DNA 序列。我们首先选取一个好长好长的 DNA 序列(小兔子是外星生物,DNA 序列可能包含 26 个小写英文字母),然后我们每次选择两个区间,询问如果用两个区间里的 DNA 序列分别生产出来两只兔子,这两个兔子是否一模一样。注意两个兔子一模一样只可能是他们的 DNA 序列一模一样。输入格式第一行一个 DN...原创 2018-11-24 22:09:34 · 268 阅读 · 0 评论 -
【牛客 -2A】矩阵(二分,字符串哈希)
题干:给出一个n * m的矩阵。让你从中发现一个最大的正方形。使得这样子的正方形在矩阵中出现了至少两次。输出最大正方形的边长。输入描述:第一行两个整数n, m代表矩阵的长和宽;接下来n行,每行m个字符(小写字母),表示矩阵;输出描述:输出一个整数表示满足条件的最大正方形的边长。 示例1输入复制5 10ljkfghdfasisdfjksiyepg...原创 2018-11-28 15:10:30 · 469 阅读 · 0 评论 -
【CodeForces - 798A】Mike and palindrome (回文串,水题,字符串问题)
题干:Mike has a string s consisting of only lowercase English letters. He wants to change exactly one character from the string so that the resulting one is a palindrome.A palindrome is a string tha...原创 2018-11-30 10:26:03 · 433 阅读 · 0 评论 -
【牛客 - 272A】Phrase String(构造,水题)
题干:给出v, k,请你找到最小的正整数n,满足:n的二进制表示下存在一个长度为v的回文串,该回文串首尾都是1且n的二进制表示中至少有k个1。保证v,k均为偶数!由于n可能很大,你只需要输出对取模的结果。输入描述:两个整数v, k。保证v,k均为偶数!输出描述:一个整数,表示n对取模的结果。示例1输入复制6 4输出复制45说明...原创 2018-11-30 20:50:06 · 404 阅读 · 0 评论 -
【CodeForces - 289C】Polo the Penguin and Strings (水题,字符串,思维构造,有坑)
题干:Little penguin Polo adores strings. But most of all he adores strings of length n.One day he wanted to find a string that meets the following conditions:The string consists of n lowercase Eng...原创 2018-11-28 14:24:34 · 382 阅读 · 0 评论 -
【CodeForces - 508B】Anton and currency you all know (思维贪心)
题干:Berland, 2016. The exchange rate of currency you all know against the burle has increased so much that to simplify the calculations, its fractional part was neglected and the exchange rate is now...原创 2018-12-27 19:43:00 · 456 阅读 · 0 评论 -
【牛客 - 289 I】这是一个沙雕题I (字符串问题,水题)
题干:因为毒瘤出题人出的题都太难了,于是gugugu打算出一个签到题,(就是这题啦),这题很简单,给定一个字符串,请问你重新排序后能不能组成K个相同的字符串。输入描述:多组数据输入,第一行输入k表示需要k个相同的字符串个数,第二行给出指定的字符串s。字符串长度l (1≤ k ≤ l ≤ 100)输入的字符串仅由小写字母组成输出描述:对于每组数据输出一行:如果能组成k个...转载 2018-12-26 15:45:40 · 266 阅读 · 0 评论 -
【牛客OI周赛7-普及组ABCD 非官方题解】暴力,二分,KMP,尺取(STL或Hash)
A:链接:https://ac.nowcoder.com/acm/contest/372/A来源:牛客网某天,一只可爱的肥橘喵在路上走,突然遇到了一个怪人,那怪人自称PM6,“小肥喵,这里有一道水题,答对了我就请你吃狗肉,答错了你就请我吃猫肉!”喵咪瑟瑟发抖:“QAQ什么题?”PM6道:“给你坐标轴上的N个点,求出对于每个点,有多少个点的 X 坐标和 Y 坐标都大于它。”...原创 2019-02-24 09:41:29 · 628 阅读 · 0 评论 -
*【牛客 1 - A】矩阵(字符串hash)
题干:给出一个n * m的矩阵。让你从中发现一个最大的正方形。使得这样子的正方形在矩阵中出现了至少两次。输出最大正方形的边长。输入描述:第一行两个整数n, m代表矩阵的长和宽;接下来n行,每行m个字符(小写字母),表示矩阵;输出描述:输出一个整数表示满足条件的最大正方形的边长。示例1输入复制5 10ljkfghdfasisdfjksiyepgl...原创 2019-03-01 13:07:32 · 403 阅读 · 0 评论 -
【Codeforces - 127D】Password(思维,二分+字符串Hash)
题干:Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later...原创 2019-10-09 20:26:50 · 426 阅读 · 1 评论 -
【POJ - 1850】Code (组合数学,字符串另类排序)
题干:Transmitting and memorizing information is a task that requires different coding systems for the best use of the available space. A well known system is that one where a number is associated to a...原创 2018-11-08 11:49:40 · 293 阅读 · 0 评论 -
【 CodeForces - 864B】Polycarp and Letters(水题,字符串,有坑)
题干:Polycarp loves lowercase letters and dislikes uppercase ones. Once he got a string sconsisting only of lowercase and uppercase Latin letters.Let A be a set of positions in the string. Let's cal...原创 2018-11-09 22:30:54 · 346 阅读 · 0 评论 -
【CodeForces - 745B】Hongcow Solves A Puzzle (思维,乱搞,字符串)
题干:Hongcow likes solving puzzles.One day, Hongcow finds two identical puzzle pieces, with the instructions "make a rectangle" next to them. The pieces can be described by an n by m grid of charact...原创 2018-09-15 16:00:42 · 303 阅读 · 0 评论 -
【CodeForces - 155C】Hometask (字符串,思维,贪心,熟悉句式)(总结)
题干:Sergey attends lessons of the N-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the N-ish language. Sentences of the N-ish language can be re...原创 2018-10-03 18:03:19 · 442 阅读 · 0 评论 -
【CodeForces - 122B 】Lucky Substring (字符串,水题)
题干:Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky ...原创 2018-10-10 18:52:40 · 389 阅读 · 0 评论 -
*【CodeForces - 122D】Lucky Transformation(字符串问题,思维剪枝,优化,有坑,需注意的问题if的层次总结)
题干:Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky ...原创 2018-10-10 18:53:28 · 367 阅读 · 0 评论 -
【CodeForces - 761C】Dasha and Password (暴力可过,标解dp,字符串,有坑总结)
题干:After overcoming the stairs Dasha came to classes. She needed to write a password to begin her classes. The password is a string of length n which satisfies the following requirements:There is ...原创 2018-09-12 11:17:20 · 508 阅读 · 0 评论 -
【HRBUST - 1054 】Brackets! Brackets! (括号匹配,思维,STL栈)
题干:There are six kinds of brackets: ‘(‘, ‘)’, ‘[‘, ‘]’, ‘{’, ‘}’. dccmx’s girl friend is now learning java programming language, and got mad with brackets! Now give you a string of brackets. Is it v...原创 2018-10-05 16:57:43 · 423 阅读 · 0 评论 -
【HDU - 5672】String(尺取法)
题干:There is a string SS.SS only contain lower case English character.(10≤length(S)≤1,000,000)(10≤length(S)≤1,000,000) How many substrings there are that contain at least k(1≤k≤26)k(1≤k≤26) distinct...原创 2018-10-05 23:43:46 · 536 阅读 · 0 评论 -
【CodeForces - 1038A 】Equality (思维水题,预处理字符串)
题干:You are given a string ss of length nn, which consists only of the first kk letters of the Latin alphabet. All letters in string ss are uppercase.A subsequence of string ss is a string that can...原创 2018-10-13 21:04:08 · 541 阅读 · 0 评论 -
【CodeForces - 1051A】Vasya And Password (构造,水题)
题干:Vasya came up with a password to register for EatForces — a string ss. The password in EatForces should be a string, consisting of lowercase and uppercase Latin letters and digits.But since Eat...原创 2018-09-29 00:55:36 · 639 阅读 · 0 评论 -
【CodeForces - 357D】Xenia and Hamming (字符串问题,数论,思维)
题干:Xenia is an amateur programmer. Today on the IT lesson she learned about the Hamming distance.The Hamming distance between two strings s = s1s2... sn and t = t1t2... tn of equal length n is val...原创 2018-10-10 20:11:13 · 313 阅读 · 0 评论 -
【CodeForces - 1066A~E】水题,模拟(有技巧),思维,题意难懂的模拟,二进制问题(有技巧)
A.题目大意: x坐标上1~L有L个点都是整数,每v个长度就有一个灯亮着,但是有 [ l , r ] 这段区间上有列火车挡住了,问你能看到多少亮灯。解题报告: 大水题啊,找几个样例就会发现需要特殊处理一下左边界恰好有灯的情况。AC代码:#include<bits/stdc++.h>using namespace std;int L,v,l,r,a...原创 2018-10-20 00:14:26 · 499 阅读 · 0 评论 -
【CodeForces - 202A】LLPS (思维,字符串)
题干:This problem's actual name, "Lexicographically Largest Palindromic Subsequence" is too long to fit into the page headline.You are given string s consisting of lowercase English letters only. Fi...原创 2018-10-26 22:36:20 · 811 阅读 · 0 评论 -
【CodeForces - 255B】Code Parsing(思维,字符串)
题干:Little Vitaly loves different algorithms. Today he has invented a new algorithm just for you. Vitaly's algorithm works with string s, consisting of characters "x" and "y", and uses two following ...原创 2018-11-09 21:52:49 · 335 阅读 · 0 评论 -
【牛客161 - A】字符串(尺取法,桶标记法)
题干:时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 32768K,其他语言65536K64bit IO Format: %lld题目描述小N现在有一个字符串S。他把这这个字符串的所有子串都挑了出来。一个S的子串T是合法的,当且仅当T中包含了所有的小写字母。小N希望知道所有的合法的S的子串中,长度最短是多少。输入描述:一行一个字符串S。只包含小写字母。S的长...原创 2018-09-13 11:41:20 · 865 阅读 · 0 评论