摘要: 严格按题解写,看能不能形成sum,只需要分割当前sum怎么由两边组成就好 #include <cstdio> #include <cstring> #include <cmath> #include <vector> #include <algorithm> using namespace std; 阅读全文
posted @ 2016-08-07 22:06 shuguangzw 阅读(297) 评论(0) 推荐(0) 编辑
摘要: #include <cstdio> #include <cstring> #include <cmath> #include <vector> #include <algorithm> using namespace std; typedef long long LL; const int N = 阅读全文
posted @ 2016-08-07 22:03 shuguangzw 阅读(198) 评论(0) 推荐(0) 编辑
摘要: 分析:大于等于m的变成1,否则变成0,预处理前缀和,枚举起点,找到第一个点前缀和大于m即可 找第一个点可以二分可以尺取 #include <cstdio> #include <cstring> #include <cmath> #include <algorithm> using namespace 阅读全文
posted @ 2016-08-07 21:58 shuguangzw 阅读(171) 评论(0) 推荐(0) 编辑
摘要: 分析:维护空隙的差,然后预处理前缀最大,后缀最大,扫一遍 #include <cstdio> #include <cstring> #include <cmath> #include <algorithm> using namespace std; typedef long long LL; con 阅读全文
posted @ 2016-08-07 21:48 shuguangzw 阅读(184) 评论(0) 推荐(0) 编辑
摘要: 分析:大于总和输出1 #include <cstdio> #include <cstring> #include <algorithm> using namespace std; typedef long long LL; const int N = 1e5+5; int ret[N],T,n,m; 阅读全文
posted @ 2016-08-07 21:37 shuguangzw 阅读(192) 评论(0) 推荐(0) 编辑
摘要: 分析:考虑贪心,考虑填ans[i],前i-1个合法,现在剩下一些数, 那么挑出出现次数最多的数,次数为mx,当前剩余总数为sum 如果sum-mx>=mx-1那么肯定有解,这个想想就知道了(这种题做过无数遍了) 考虑当前填的数,如果sum-mx=mx-1,那么只能填出现次数最多的数 否则,贪心选择和 阅读全文
posted @ 2016-08-07 15:09 shuguangzw 阅读(162) 评论(0) 推荐(0) 编辑