题意:求最长可以分a b a为三部分子串,a b a可以为空 思路在代码里 1 #include<cstdio> 2 #include<iostream> 3 #include<cstring> 4 #include<cmath> 5 #include<algorithm> 6 #define maxn 505 7 using namespace std; 8 int main(){ 9 char a[5001]; 10 int b[5001],…
题目链接:http://codeforces.com/contest/877/problem/B Nikita and string time limit per test2 seconds memory limit per test256 megabytes Nikita thinks that string is beautiful if it can be cut into 3 strings (possibly empty) without changing the order of t…
题目大意 两个人轮流在一个字符串上删掉一个字符,没有字符可删的人输掉游戏 删字符的规则如下: 1. 每次从一个字符串中选取一个字符,它是一个长度至少为 3 的奇回文串的中心 2. 删掉该字符,同时,他选择的那个字符串分成了两个独立的字符串 现在问,先手是否必胜,如果先手必胜,输出第一步应该删掉第几个字符,有多解的话,输出序号最小的那个 字符串的长度不超过5000,只包含小写英文字母 做法分析 可以这样考虑:将所有的长度大于等于 3(其实只需要找长度为 3 的就行)的奇回文串的中心标记出来 我们将…
Codeforces Round #297 (Div. 2)B. Pasha and String Time Limit: 2 Sec  Memory Limit: 256 MBSubmit: xxx  Solved: 2xx 题目连接 http://codeforces.com/contest/525/problem/B Description Pasha got a very beautiful string s for his birthday, the string consists o…
题目传送门 /* 题意:给出m个位置,每次把[p,len-p+1]内的字符子串反转,输出最后的结果 字符串处理:朴素的方法超时,想到结果要么是反转要么没有反转,所以记录 每个转换的次数,把每次要反转的反转就不超时了:) */ #include <cstdio> #include <algorithm> #include <cstring> using namespace std; ; const int INF = 0x3f3f3f3f; char s[MAXN]; i…
A. Alex and broken contest 题意 判断一个字符串内出现五个给定的子串多少次. Code #include <bits/stdc++.h> char s[110]; using namespace std; typedef long long LL; char* rec[5] = {"Danil", "Olya", "Slava", "Ann", "Nikita"}; i…
A. Alex and broken contest time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output One day Alex was creating a contest about his friends, but accidentally deleted it. Fortunately, all the problems…
A. Alex and broken contest time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output One day Alex was creating a contest about his friends, but accidentally deleted it. Fortunately, all the problems…
B. Nikita and string One day Nikita found the string containing letters "a" and "b" only. Nikita thinks that string is beautiful if it can be cut into 3 strings (possibly empty) without changing the order of the letters, where the 1-st…
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 枚举中间那一段从哪里开始.哪里结束就好 注意为空的话,就全是a. 用前缀和优化一下. [代码] #include <bits/stdc++.h> using namespace std; const int N = 5e3; string s; int a[N+10],pre[N+10][2],ans; int main(){ //freopen("rush.txt","r",stdin…