题目链接: D. Alyona and Strings time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output After returned from forest, Alyona started reading a book. She noticed strings s and t, lengths of which are n a…
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output 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, rea…
time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Anatoly lives in the university dorm as many other students do. As you know, cockroaches are also living there together with students. Cockro…
题目链接 可以发现 十进制4 对应 二进制100 十进制16 对应 二进制10000 十进制64 对应 二进制1000000 可以发现每多两个零,4的次幂就增加1. 用string读入题目给定的二进制数字,求出其长len,当len为奇数时,第一位为1,后面的位数如果都为0,则输出len,如果有一个不为0,则输出len+1: 当len为偶数时,则输出len.(之所以这样输出是因为题目给定4的次幂是从0开始的) #include<iostream> #include<string> #…
题目链接:http://codeforces.com/contest/682/problem/D 给你两个字符串,求两个字符串中顺序k个的相同子串 长度之和.(注意是子串) dp[i][j][k][0] 表示a[i] == a[j]时,a字符串前i个和b字符串前j个,顺序k个相同的子串 长度之和 dp[i][j][k][1] 表示a[i] != a[j]时,顺序k个相同子串的长度之和 dp[i][j][k][0] = max(dp[i - 1][j - 1][k][0], dp[i - 1][j…
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Kevin Sun wants to move his precious collection of n cowbells from Naperthrill to Exeter, where there is actually grass instead of corn. Before…
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Innokentiy likes tea very much and today he wants to drink exactly n cups of tea. He would be happy to drink more but he had exactly n tea bags,…
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output The process of mammoth's genome decoding in Berland comes to its end! One of the few remaining tasks is to restore unrecognized nucleotides in a…
题目链接: http://codeforces.com/gym/100526 http://acm.hunnu.edu.cn/online/?action=problem&type=show&id=11674&courseid=0 题目大意: N个学生M道题(1<=N<=12,1<=M<=30),每道题只有正误两种选项(0 1),每个学生的答题情况和正确题数已知,求标准答案可能有多少种. 如果标准答案只有一种则输出标准答案,否则输出解的个数. 题目思路: […
[题目链接]:http://codeforces.com/contest/785/problem/D [题意] 给你一个长度为n的括号序列; 让你删掉若干个括号之后,整个序列变成前x个括号为左括号,后x个括号为右括号; 问你有多少种删除方法. [题解] 先考虑一个简单的问题 对于一个括号序列,如果前x个括号都是左括号,后y个括号都是右括号; ((()))) 那么这个序列的RSBS的个数为C(X+Y,X) 即相当于构造一个长度为x+y的序列,包含x个1,y个0 如上述括号序列 这里即构造一个长度为…