CF B. Kolya and Tandem Repeat】的更多相关文章

Kolya got string s for his birthday, the string consists of small English letters. He immediately added k more characters to the right of the string. Then Borya came and said that the new string contained a tandem repeat of length l as a substring. H…
B. Kolya and Tandem Repeat time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Kolya got string s for his birthday, the string consists of small English letters. He immediately added k more ch…
纯粹练JAVA.... B. Kolya and Tandem Repeat time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Kolya got string s for his birthday, the string consists of small English letters. He immediately add…
 Kolya and Tandem Repeat time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Kolya got string s for his birthday, the string consists of small English letters. He immediately added k more ch…
题目链接:http://codeforces.com/contest/443/problem/B 题目意思:给出一个只有小写字母的字符串s(假设长度为len),在其后可以添加 k 个长度的字符,形成一个长度为len+k的新串 s'.问在 s' 中,可以形成的最长tandem repeat 是 多长.tandem repeat 的定义是:si = si+n (1 <= i <= n; 2*n <= k+len) 注意,这个tandem repeat 是相邻的!!也就是对于abcwerabc…
本题要考虑字符串本身就存在tandem, 如测试用例 aaaaaaaaabbb 3 输出结果应该是8而不是6,因为字符串本身的tanderm时最长的 故要考虑字符串本身的最大的tanderm和添加k个字符后最大的tanderm #include <iostream> #include <vector> #include <algorithm> #include <string> #include <set> using namespace std…
题意:给出一个字符串,给出k,可以向该字符串尾部添加k个字符串,求最长的连续重复两次的子串 没有想出来= =不知道最后添加的那k个字符应该怎么处理 后来看了题解,可以先把这k个字符填成'*',再暴力枚举起点和长度,找出最大的长度 #include<iostream> #include<cstdio> #include<cstring> #include <cmath> #include<stack> #include<vector>…
题目:Click here 题意:给定一个字符串(只包含小写字母,并且最长200)和一个n(表示可以在给定字符串后面任意加n(<=200)个字符).问最长的一条子串长度,子串满足前半等于后半. 分析:暴力~~~~~~ #include <bits/stdc++.h> using namespace std; typedef long long ll; const int INF = 0x3f3f3f3f; ; int k; char str[M]; int ans, len, lenth…
题目大意:3n个人围着一张桌子,给每个人发钱,可以使1块.2块.3块,第i个人的金额为Ai.若存在第个人使得Ai + Ai+n + Ai+2n != 6,则该分配方案满足条件,求所有的满足条件的方案数 结果 MOD 1000000007. 解题思路:当 n = 1 时有总共有27中情况,其中20中满足条件,则 (27^n - 7^n)为所求结果. 代码 #include<iostream> #include<cstdio> #include<cstdlib> using…
layout: post title: Codeforces Round 253 (Div. 2) author: "luowentaoaa" catalog: true tags: mathjax: true - codeforces - 模拟栈 - 贪心 传送门 A.Anton and Letters (签到) 题意 判断字符串里面有多少个不同字符 思路 直接set一下 #include<bits/stdc++.h> using namespace std; typed…