Codeforces Round #587 (Div. 3) A. Prefixes】的更多相关文章

链接: https://codeforces.com/contest/1216/problem/A 题意: Nikolay got a string s of even length n, which consists only of lowercase Latin letters 'a' and 'b'. Its positions are numbered from 1 to n. He wants to modify his string so that every its prefix…
                                                    D. Prefixes and Suffixes You have a string s = s1s2...s|s|, where |s| is the length of string s, and si its i-th character. Let's introduce several definitions: A substring s[i..j] (1 ≤ i ≤ j ≤ |s|)…
https://codeforces.com/contest/1216/problem/A A. Prefixes 题意大概就是每个偶数位置前面的ab数目要相等,很水,被自己坑了 1是没看见要输出修改后的字符串,2是修改的写反了..3是忘记清零了?,生生把罚时拖的... 本来四分钟的题的..然后罚时+10分钟过题,我晕了,以后还是要再认真一点,比如说把样例测完.. #include<bits/stdc++.h> using namespace std; typedef long long ll…
D. Prefixes and Suffixes time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You have a string s = s1s2...s|s|, where |s| is the length of string s, and si its i-th character. Let's introduce s…
链接: https://codeforces.com/contest/1216/problem/D 题意: There were n types of swords in the theater basement which had been used during the plays. Moreover there were exactly x swords of each type. y people have broken into the theater basement and eac…
链接: https://codeforces.com/contest/1216/problem/C 题意: There is a white sheet of paper lying on a rectangle table. The sheet is a rectangle with its sides parallel to the sides of the table. If you will take a look from above and assume that the botto…
链接: https://codeforces.com/contest/1216/problem/B 题意: Recently Vasya decided to improve his pistol shooting skills. Today his coach offered him the following exercise. He placed n cans in a row on a table. Cans are numbered from left to right from 1…
题目:https://codeforces.com/contest/1216/problem/F 题意:一排有n个位置,我要让所有点都能联网,我有两种方式联网,第一种,我直接让当前点联网,花费为i,第二种,如果当前点的值为1,代表当前点可以放置一个路由器,范围 [i-k,i+k]都能连上网,花费为i,求最小花费是所有点都能连上网 思路:这个很容易看出是一个DP,我们设立dp[i],为前i个位置都能连上网的最小花费,因为设立一个路由器左右范围都可以联网,所以我们考虑设立路由器的右端点,如果i-k可…
题目链接 题意:给你一个长度n,还有2*n-2个字符串,长度相同的字符串一个数前缀一个是后缀,让你把每个串标一下是前缀还是后缀,输出任意解即可. 思路;因为不知道前缀还是后缀所以只能搜,但可以肯定的是长度为n-1的字符串一个是前缀一个是后缀,那么只要搜两次就完事了,一个当前缀不行就换另一个当前缀,然后中间判断一下即可. ps:这也是给远古题,没补,因为最不喜欢 字符串的题,,,qwq. #include<bits/stdc++.h> #define LL long long #define f…
C. White Sheet There is a white sheet of paper lying on a rectangle table. The sheet is a rectangle with its sides parallel to the sides of the table. If you will take a look from above and assume that the bottom left corner of the table has coordina…