bzoj2789[Poi2012]Letters 题意: 给出两个长度相同且由大写英文字母组成的字符串A、B,保证A和B中每种字母出现的次数相同。现在每次可以交换A中相邻两个字符,求最少需要交换多少次可以使得A变成B。长度≤1000000 题解: 把A串中所有字母替换成该字母在B串中的位置,如果有相 ...
分类:
其他好文 时间:
2016-09-04 15:59:59
阅读次数:
179
Given an arbitrary ransom note string and another string containing letters from all the magazines, write a function that will return true if the rans ...
分类:
其他好文 时间:
2016-09-04 01:34:04
阅读次数:
144
[题目] Given two strings s and t which consist of only lowercase letters. String t is generated by random shuffling string s and then add one more lette ...
分类:
其他好文 时间:
2016-09-03 16:33:36
阅读次数:
171
贪心。 肯定是两个$a$之间的那些字符都$-1$,没有$a$就全部$-1$。如果输入的串全是$a$,那么把最后一个$a$改成$z$。 ...
分类:
其他好文 时间:
2016-09-02 22:00:23
阅读次数:
159
Given two strings s and t which consist of only lowercase letters. String t is generated by random shuffling string s and then add one more letter at ...
分类:
其他好文 时间:
2016-09-02 06:24:29
阅读次数:
140
There is a new alien language which uses the latin alphabet. However, the order among letters are unknown to you. You receive a list of words from the ...
分类:
其他好文 时间:
2016-09-02 00:41:26
阅读次数:
199
Given two strings s and t which consist of only lowercase letters. String t is generated by random shuffling string s and then add one more letter at ...
分类:
其他好文 时间:
2016-09-01 18:35:05
阅读次数:
108
Given two strings s and t which consist of only lowercase letters. String t is generated by random shuffling string s and then add one more letter at ...
分类:
其他好文 时间:
2016-08-31 23:58:22
阅读次数:
473
问题描述: A message containing letters from A-Z is being encoded to numbers using the following mapping: Given an encoded message containing digits, deter ...
分类:
其他好文 时间:
2016-08-30 18:00:11
阅读次数:
167
Given two strings s and t which consist of only lowercase letters. String t is generated by random shuffling string s and then add one more letter at ...
分类:
其他好文 时间:
2016-08-29 06:55:30
阅读次数:
397