![](https://img-blog.csdnimg.cn/20201014180756923.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
codeforces
deebcjrb
这个作者很懒,什么都没留下…
展开
-
Codeforces Round #661 (Div. 3) D. Binary String To Subsequences(队列)
http://codeforces.com/contest/1399/problem/D 给出一个长度为n的0、1组成的字符串,分为k个子字符串,使得每个子串没有连续的0、1,求k的最小值和子串的所属编号 使用两个队列q0,q1分别存储0和1的下标(同时两个队列的长度之差也体现了0和1的数量差),遍历字符串:遇见’0’时,若s1为空则必须开辟一个新的子序列来存储这个多出来的’0’,若s1不为空,它就直接放到上一个1所在的子序列的后面,也就是子序列编号相同。遇见’1’时同理 #include<i原创 2020-08-11 00:25:25 · 152 阅读 · 2 评论 -
Codeforces Round #661 (Div. 3) C. Boats Competition
http://codeforces.com/problemset/problem/1399/C 双指针,枚举2-2*n。 #include<iostream> #include<string> #include<math.h> #include<algorithm> typedef long long ll; ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } ll lcm(ll a, ll b)原创 2020-08-10 19:48:41 · 112 阅读 · 0 评论 -
Codeforces Round #663 (Div. 2) C. Cyclic Permutations
http://codeforces.com/contest/1391/problem/C 参考文章https://blog.csdn.net/li_wen_zhuo/article/details/107904623?utm_medium=distribute.pc_relevant.none-task-blog-title-2&spm=1001.2101.3001.4242 给你一个数n,n的全排列中每一个序列根据如下规则建图: 1<=i<=n,找到最大的j使得1<=j<原创 2020-08-10 17:42:43 · 83 阅读 · 0 评论 -
Codeforces Round #658 (Div. 2) C1. Prefix Flip (Easy Version)
http://codeforces.com/contest/1382/problem/C1 给出 t 组样例,对于每组样例给出一个长度 n ,然后输入两个01串a b,然后有这样一个操作:选择长度为 i 的前缀,全部取反并逆置,询问能否在3n个操作以内使a b 相等,输出操作次数以及每次操作所选择的前缀。 如果s i != s1 i ,则可以先取i (取反并逆置),然后再取1,改第一个字母,然后再取 i ,取反逆置,就可以实现单个字母的修改,如果是第一个字母不同的话只需要修改1 次 1 即可 #in原创 2020-07-25 23:56:27 · 90 阅读 · 0 评论 -
Codeforces Round #659 (Div. 2) Common Prefixes(构造字符串)
http://codeforces.com/contest/1384/problem/A 输入一个数组,要求输出的两两字符串之间前a[i]个字符相同 #include<iostream> #include<string> #include<math.h> #define LL long long #define N 10000005 using namespace std; int a[N]; int main() { int t; cin >>原创 2020-07-25 19:30:26 · 112 阅读 · 0 评论