Codeforces 946 C.String Transformation】的更多相关文章

C. String Transformation   time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You are given a string s consisting of |s| small english letters. In one move you can replace any character of thi…
G.String Transformation 题目描述 Bobo has a string S = s1 s2...sn consists of letter a , b and c . He can transform the string by inserting or deleting substrings aa , bb and abab .Formally, A = u ? w ? v (“ ? ” denotes string concatenation) can be trans…
Codeforces 题面传送门 & 洛谷题面传送门 神奇的强迫症效应,一场只要 AC 了 A.B.D.E.F,就一定会把 C 补掉( 感觉这个 C 难度比 D 难度高啊-- 首先考虑对问题进行初步转化.显然对于 \(s_i=s_j,t_i=t_j\)​ 的 \((i,j)\)​,我们肯定会将它们放在一起操作,这启发我们将所有 \((s_i,t_i)\)​ 看作一个二元组,那么如果我们把"每一步将字符 \(x\) 变为 \(y\)"这样的操作视作一条从 \(x\) 连向 \(y…
原文链接https://www.cnblogs.com/zhouzhendong/p/CF109D.html 题目传送门 - CF109D 题意 给定两个字符串 $a,b$ ,求一组 $i,j$ 使得 $f(a,i,j)=b$ .如果无解输出 "-1 -1" ,如果多组解,输出 i 尽量大的:如果 i 相同,输出 j 尽量小的. 其中 $f(s,i,j) = s[i+1 \cdots j-1] + r(s[0 \cdots i]) + r(s[j\cdots n-1])$ . $n$…
http://codeforces.com/problemset/problem/946/C You are given a string s consisting of |s| small english letters. In one move you can replace any character of this string to the next character in alphabetical order (a will be replaced with b, s will b…
题目链接:http://codeforces.com/problemset/problem/797/C 题意: 给你一个非空字符串s,空字符串t和u.有两种操作:(1)把s的首字符取出并添加到t的末尾.(2)把t的尾字符取出并添加到u的末尾. 问你当经过一系列操作后,s和t均为空时,字典序最小的u. 题解: 操作的本质: s为队列,t为栈. 贪心思路: (1)找到s中的最小字符c,不断出队并加入t,直至有一次出队的字符等于c,停止出队. (2)当t的尾字符小于等于s中的最小字符时,优先弹出t的尾…
Grigory loves strings. Recently he found a metal strip on a loft. The strip had length n and consisted of letters "V" and "K". Unfortunately, rust has eaten some of the letters so that it's now impossible to understand which letter was…
C. Minimal string 题目链接:http://codeforces.com/problemset/problem/797/C time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Petya recieved a gift of a string s with length up to 105 characters fo…
C. Palindrome Transformation time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Nam is playing with a string on his computer. The string consists of n lowercase English letters. It is meaningl…
/** 题目:F. String Compression 链接:http://codeforces.com/problemset/problem/825/F 题意:压缩字符串后求最小长度. 思路: dp[i]表示前i个字符需要的最小次数. dp[i] = min(dp[j]+w(j+1,i)); (0<=j<i); [j+1,i]如果存在循环节(自身不算),那么取最小的循环节x.w = digit((i-j)/x)+x; 否则w = i-j+1; 求一个区间最小循环节: 证明:http://w…