摘要: 链接 [http://codeforces.com/group/1EzrFFyOc0/contest/701/problem/C] 题意 给你一个包含大小写字母长度为n的字符串,让你找包含所有种类字符的最短串 分析 其实这个用尺取法,先从开始找包含各种字符的串,然后不断地贪心取最小ans,具体看代码 阅读全文
posted @ 2018-08-18 21:57 ChunhaoMo 阅读(253) 评论(0) 推荐(0)
摘要: ###链接 [http://codeforces.com/group/1EzrFFyOc0/contest/701/problem/D] ###题意 n个人,走lm,有车但没人只能坐一次,车容量为k,人速度v1,车速度v2,问所有人走完需要的最小时间 ###分析 其实是个数学问题 ###代码 阅读全文
posted @ 2018-08-18 17:33 ChunhaoMo 阅读(105) 评论(0) 推荐(0)
摘要: 传送门 [http://codeforces.com/contest/1023/problem/C] 题意 n字符串长度,k要求的字符串的长度,字符串只包含'('和')',而且这两种的数量相等,要求的字符串是原始的子串 分析 很简单,'('和')'一对对消去即可,记录'('的位置 代码 includ 阅读全文
posted @ 2018-08-18 16:33 ChunhaoMo 阅读(194) 评论(0) 推荐(0)
摘要: 传送门 [http://codeforces.com/contest/898/problem/C] 题意 题意比较难理解直接看样例就知道了,给你个n接下来n行,每行包括一个名字和号码的数量,还有具体的每个号码 让你整理他的电话本,使得一个人的号码不能有重复,而且一个号码不能是另一个号码的后缀 分析 阅读全文
posted @ 2018-08-18 15:11 ChunhaoMo 阅读(232) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2018-08-16 14:51 ChunhaoMo 阅读(296) 评论(0) 推荐(0)
摘要: ``` include using namespace std; int n,sum; int c[100]; void search(int cur){ if(cur==n) sum++; else for(int i=0;i n){ sum=0; search(0); cout 阅读全文
posted @ 2018-08-15 20:42 ChunhaoMo 阅读(338) 评论(0) 推荐(0)
摘要: 增量构造法,位向量法,二进制法 include using namespace std; void print_sub(int n,int cur){ for(int i=0;i n){ for(int i=0;i 阅读全文
posted @ 2018-08-15 20:38 ChunhaoMo 阅读(341) 评论(0) 推荐(0)
摘要: 先分治再合并 代码 include using namespace std; define ll long long int a[1000],t[1000]; void merge_sort(int A[],int x,int y,int T[]){ if(y x 1){ int m=x+(y x) 阅读全文
posted @ 2018-08-15 17:33 ChunhaoMo 阅读(205) 评论(0) 推荐(0)
摘要: 暴力 O(n方) 前缀和优化O(n n) 分治O(n log(n)) include using namespace std; define ll long long int a[16177216]; ll solve(int l,int r){ if(l==r) return a[r]; int 阅读全文
posted @ 2018-08-15 15:24 ChunhaoMo 阅读(668) 评论(0) 推荐(0)
摘要: 用法 字典序全排列 可以发现函数next_permutation()是按照字典序产生排列的,并且是从数组中当前的字典序开始依次增大直至到最大字典序。 代码 include include using namespace std; define ll long long int main(){ int 阅读全文
posted @ 2018-08-14 15:38 ChunhaoMo 阅读(79) 评论(0) 推荐(0)