CF410div2 B. Mike and strings】的更多相关文章

/* CF410div2 B. Mike and strings http://codeforces.com/contest/798/problem/B 字符串 暴力 题意:给你n个串,每次操作可以将某个串的第一个字符放到最后去, 问最少的次数,使得所有字符串都相同 思路:先将所有字符串复制成二倍,然后暴力枚举要变成的串 注意数组都要开二倍.. */ #include <cstdio> #include <algorithm> #include <cstring> #i…
B. Mike and strings time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Mike has n strings s1, s2, ..., sn each consisting of lowercase English letters. In one move he can choose a string si,…
B. Mike and strings time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Mike has n strings s1, s2, ..., sn each consisting of lowercase English letters. In one move he can choose a string si,…
/* CF410div2 A. Mike and palindrome http://codeforces.com/contest/798/problem/A 水题 */ #include <cstdio> #include <algorithm> #include <cstring> #include <cmath> #include <vector> #include <queue> #include <iostream&g…
/* CF410div2 D. Mike and distribution http://codeforces.com/contest/798/problem/D 构造 题意:给出两个数列a,b,求选出n/2+1个数对,使得其和的二倍大于各自的数列 思路:对数列a进行排序,因为可以选一半加1个,所以最大的那个我们选出来 然后在剩下的数列中,每隔两个选则b中较大的, 这样可以保证选出的在b中满足条件,并且在a中也满足条件 然而....我他喵的居然忘了读入b数列!!!! */ #include <c…
time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Mike has n strings s1, s2, ..., sn each consisting of lowercase English letters. In one move he can choose a string si, erase the first char…
传送门 Description Mike has n strings s1, s2, ..., sn each consisting of lowercase English letters. In one move he can choose a string si, erase the first character and append it to the end of the string. For example, if he has the string "coolmike"…
Mike has n strings s1, s2, ..., sn each consisting of lowercase English letters. In one move he can choose a string si, erase the first character and append it to the end of the string. For example, if he has the string "coolmike", in one move h…
题目链接 时间复杂度 O(n*n*|s| ) 纯暴力,通过string.substr()函数来构造每一个字符串平移后的字符串. #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <cmath> #include <queue> #include <stack> #include <map>…
题目链接 题意:英语很简单,自己取读吧. 思路: 既然n和i字符串的长度都很小,最大才50,那么就是只要能出答案就任意暴力瞎搞. 本人本着暴力瞎搞的初衷,写了又臭又长的200多行(代码框架占了50行).反正不忘初衷就对了. 暴力:枚举每一个字符串,然后暴力去算其他字符串变成该字符串需要用多少步骤,然后在众多答案中取最小值. 需要注意的是答案是-1的情况,需要用到字符串的最小表示法,预处理进行把所有的字符串变成最小表示法的字符串,如果有不一样的,那么就输出-1.因为可以通过首位对接搞成的字符串的最…