A Serial Killer time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Our beloved detective, Sherlock is currently trying to catch a serial killer who kills a person each day. Using his powers o…
[题目链接]:http://codeforces.com/contest/776/problem/A [题意] 这个杀手每天会除掉一个人; 这个杀手每天都有两个目标; 给你它杀人的日志,以及这个人被杀掉之后替代的人是谁; 让你输出每天杀人的两个目标; [题解] /* 可以边读边操作; s1记录第一个人,s2记录第二个人; 输入a b两个字符串 cout << s1 << ' '<<s2<<endl; if (a==s1) { s1 = b; } else {…
http://codeforces.com/problemset/problem/1009/B B. Minimum Ternary String time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You are given a ternary string (it is a string which consists only…
[题目链接]:http://codeforces.com/problemset/problem/709/D [题意] 给你一个序列; 给出01子列和10子列和00子列以及11子列的个数; 然后让你输出一个符合要求的序列; [题解] 这里 00和11可以确定出序列中0和1的个数; 但有边缘数据 00如果为0代表什么? ->没有0或者是有1个0 11如果为0代表什么? ->没有1或者是有1个1 对这两种情况需要特判一下(两种情况的特判需要用到01和10的数量) 看代码吧. 然后这两种情况排除之后;…
(easy version): 题目链接:http://codeforces.com/contest/1296/problem/E1 题目一句话就是说,两种颜色不同的字符可以相互换位, 问,对这字符串用最多两种颜色染色,然后经过有限次换位 可以变成字典序排序的顺序. 思路:一个字符需不需要换位,应该是参照最后的字典序的顺序, 那么,我们应该给字符串排序,再去思考问题. 我们知道,如果str[now_i]的位置和排序后的位置不一样,那就是需要换位. 我们还知道,如果str[now_i]的当前位置如…
题目链接: D. Recover the String time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output For each string s consisting of characters '0' and '1' one can define four integers a00, a01, a10 and a11, where …
题目链接: E. Generate a String time limit per test 2 seconds memory limit per test 512 megabytes input standard input output standard output zscoder wants to generate an input file for some programming competition problem. His input is a string consistin…
题目链接:http://codeforces.com/problemset/problem/710/E 加或者减一个字符代价为x,字符数量翻倍代价为y,初始空字符,问你到n个字符的最小代价是多少. dp[i]表示i个字符的最小代价. 当i为偶数个的时候,由+1或者*2得到. 当i为奇数个的时候,由+1或者*2-1得到. //#pragma comment(linker, "/STACK:102400000, 102400000") #include <algorithm>…
题目链接: C. Vasya and String time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output High school student Vasya got a string of length n as a birthday present. This string consists of letters 'a' and '…
题目链接:http://codeforces.com/problemset/problem/598/B 题目分类:字符串 题意:给定一个串,然后n次旋转,每次给l,r,k,表示区间l到r的字符进行k次平移,具体移动规则看题意,求经过n次旋转之后字符串是怎样的 题目分析:自己的做法比较麻烦,后来发现别人用函数给做出来了,贴代码 代码: #include <bits/stdc++.h> using namespace std; int m; ]; int main() { scanf("…