You are given n strings s1, s2, ..., sn consisting of characters 0 and 1. m operations are performed, on each of them you concatenate two existing strings into a new one. On the i-th operation the concatenation saisbi is saved into a new string sn + …
A. Petya and Strings 点击打开题目 time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Little Petya loves presents. His mum bought him two strings of the same size for his birthday. The strings consi…
A. Petya and Strings time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Little Petya loves presents. His mum bought him two strings of the same size for his birthday. The strings consist of u…
假如两个区间的26的字母出现的位置集合分别是 A1,B1,A2,B2,....., 我们再能找到一个排列p[] 使得 A[i] = B[p[i]] ,那么就可以成功映射了. 显然集合可以直接hash,排序一下hash值就可以判断是否匹配了.... 虽然不知道为什么要卡19260817,但反正我是坚决不写双hash的,最后随便换了一个大模数(甚至都不是质数2333)然后就过了... Discription You are given a string s of length n consistin…
[题目链接] https://codeforces.com/contest/452/problem/E [算法] 构建后缀数组 用并查集合并答案即可 时间复杂度 : O(NlogN) [代码] #include<bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef unsigned long long ull; ; ; #define rint register int…
题目链接: http://codeforces.com/contest/665/problem/C 题意: 改变最少的字符,使得最终序列无相同的连续的字符. 分析: 对每一个与前一个字符相同的字符,枚举满足条件的字符进行替换. 代码: #include<iostream> using namespace std; int main (void) { string s;cin>>s; int n = s.length(); for(int i = 1; i < n; i++){…
Today on a lecture about strings Gerald learned a new definition of string equivalency. Two strings a and b of equal length are called equivalent in one of the two cases: They are equal. If we split string a into two halves of the same size a1 and a2…
水题 #include<cstdio> #include<cstring> #include<algorithm> using namespace std; +; char s1[maxn],s2[maxn]; int a[maxn],b[maxn]; int lena,lenb; int c; int main() { scanf("%s%s",s1,s2); lena=strlen(s1); lenb=strlen(s2); c=; ;i>…
Error Correct System Time Limit:2000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u Submit Status Practice CodeForces 527B Description Ford Prefect got a job as a web developer for a small company that makes towels. His current work ta…
A. Comparing Strings 判断不同的位置个数以及交换后是否相等. B. Growing Mushrooms 模拟. C. Plant 矩阵+快速幂 D. Mushroom Scientists 题解:AM-GM inequality\[x^ay^bz^c=a^ab^bc^c\frac{x}{a}^a\frac{y}{b}^b\frac{z}{c}^c\le a^ab^bc^c\lgroup \frac{a\frac{x}{a}+b\frac{y}{b}+c\frac{z}{c}}…
Description Ford Prefect got a job as a web developer for a small company that makes towels. His current work task is to create a search engine for the website of the company. During the development process, he needs to write a subroutine for compari…
Ford Prefect got a job as a web developer for a small company that makes towels. His current work task is to create a search engine for the website of the company. During the development process, he needs to write a subroutine for comparing strings S…
B. Error Correct System time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Ford Prefect got a job as a web developer for a small company that makes towels. His current work task is to create…