codeforces 557E Ann and Half-Palindrome】的更多相关文章

题意简述 给定一个字符串(长度不超过5000 且只包含a.b)求满足如下所示的半回文子串中字典序第k大的子串 ti = t|t| - i + 1(|t|为字符串长度)   ---------------------------------------------------------------------------------- 比赛时看到回文串 再看到字典序第k大 满满的后缀数组一类的算法的即视感 考虑到编程复杂度以及自己本来就不熟练 于是直接放弃了 结果比赛完后听说不少人都是直接上tr…
C. Make Palindrome Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/600/problem/C Description A string is called palindrome if it reads the same from left to right and from right to left. For example "kazak", "oo&q…
题目链接: http://codeforces.com/problemset/problem/7/D D. Palindrome Degree time limit per test1 secondmemory limit per test256 megabytes 问题描述 String s of length n is called k-palindrome, if it is a palindrome itself, and its prefix and suffix of length…
D. Palindrome Degree 题目连接: http://www.codeforces.com/contest/7/problem/D Description String s of length n is called k-palindrome, if it is a palindrome itself, and its prefix and suffix of length are (k - 1)-palindromes. By definition, any string (ev…
题目链接:http://codeforces.com/contest/600/problem/C C. Make Palindrome time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output A string is called palindrome if it reads the same from left to right an…
题目链接:http://codeforces.com/contest/7/problem/D D. Palindrome Degree time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output String s of length n is called k-palindrome, if it is a palindrome itself…
[题目链接]:http://codeforces.com/contest/798/problem/A [题意] 让你严格改变一个字符,使得改变后的字符串为一个回文串; 让你输出可不可能; [题解] 直接无脑暴力改就好; 或者按照回文串的规则; 如果a[i]和a[n-i+1]不同则cnt++ 然后看看最后cnt是不是恰好为1,或者为0然后字符串长度为奇数(那样中间那个字符可以任意改) [Number Of WA] 0 [完整代码] #include <bits/stdc++.h> using n…
转换成前缀和, 预处理一下然后莫队. #include<bits/stdc++.h> #define LL long long #define fi first #define se second #define mk make_pair #define PLL pair<LL, LL> #define PLI pair<LL, int> #define PII pair<int, int> #define SZ(x) ((int)x.size()) #de…
题目链接 题意: 若一个字符串是半回文串.则满足第一位和最后一位相等, 第三位和倒数第三位相等.如此类推. 给定一个字符串s,输出s的全部子串中的半回文串字典序第k大的 字符串. good[i][j] 表示 s(i,j) 是半回文串. 把这些回文串插到字典树里 在字典树上找第k个叶子节点. 插入时:插入以i点开头的全部半回文串. #include <iostream> #include <string> #include <vector> #include <cs…
题意:给你一个长度为偶数n的数组,每次可以将一个元素修改为不大于k的值,要求每个a[i]+a[n-i+1]都相等,求最少操作多少次 题解:假设每一对的和都为sum,小的记为mn,大的记为mx;         枚举[2,2*k]的所有数x:            我们对每一对相应的数考虑,有三种情况:改一个数,改两个数,不改      1.改一个数:当x∈[mn+1,mx+k];          ==>b[mn+1]+,1,b[mx+k+1]-1; 2.该两个数:当x∈[2,mn] || [m…