题目链接:Codeforces 385B Bear and Strings 记录下每一个bear的起始位置和终止位置,然后扫一遍记录下来的结构体数组,过程中用一个变量记录上一个扫过的位置,用来去重. #include <iostream> #include <cstdio> #include <cstring> using namespace std; const int MAX_N = 5000 + 100; char str[MAX_N]; struct Node…
题目链接:Codeforces 482C Game with Strings 题目大意:给定N个字符串,如今从中选定一个字符串为答案串,你不知道答案串是哪个.可是能够通过询问来确定, 每次询问一个位置上字符为多少. 如今你询问的每一个位置的概率是同样的,(问过的位置不会再问).求询问次数的期 望. 解题思路:由于字符串长度不会大于20.所以用二进制表示询问了哪些位置.C[s]即为询问s的位置能够确定多少个字 符串. 这步不能通过枚举s,然后推断处理,复杂度为o(2^20 * 20 * 50),太…
题目链接:http://www.codeforces.com/problemset/problem/112/A题意:忽略大小写,比较两个字符串字典序大小.C++代码: #include <cstdio> #include <cstring> int cmp(char *s, char *t) { while (*s) { ; ; ; ; s ++; t ++; } ; } int main() { ]; ]; scanf("%s%s", s, t); print…
正反两遍扩展KMP,维护公共长度为L时.出如今最左边和最右边的位置. . .. 然后枚举推断... E. Martian Strings time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output During the study of the Martians Petya clearly understood that the Mart…
B. Petya and Exam time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output It's hard times now. Today Petya needs to score 100 points on Informatics exam. The tasks seem easy to Petya, but he think…
Problem description Little Petya loves presents. His mum bought him two strings of the same size for his birthday. The strings consist of uppercase and lowercase Latin letters. Now Petya wants to compare those two strings lexicographically. The lette…
Petya and Pipes Time Limit: 1000ms Memory Limit: 262144KB This problem will be judged on CodeForces. Original ID: 362E64-bit integer IO format: %I64d      Java class name: (Any)   A little boy Petya dreams of growing up and becoming the Head Berland…
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Today on a lecture about strings Gerald learned a new definition of string equivalency. Two strings a and b of equal length are called equivalen…
题目链接:http://codeforces.com/problemset/problem/362/B 题目意思:给出整数n和m,表示有n级楼梯和m级dirty的楼梯,接下来m个数表示对应是哪一个数字的楼梯是dirty的楼梯,不一定是按小到大给定的,需要判断的是,在只可以走一级.二级或三级的情况,是否可以把所有的非dirty楼梯走完.当然,如果dirty的楼梯中包含第一级(初始位置)或者最后一级(最终位置),那么默认是不能走完非dirty楼梯的. 由于给定的dirty楼梯的数字是任意无序的,所以…
Alyona and Strings 题目链接: http://acm.hust.edu.cn/vjudge/contest/121333#problem/D Description After returned from forest, Alyona started reading a book. She noticed strings s and t, lengths of which are n and m respectively. As usual, reading bored Aly…