摘要: 题目描述数据范围解法贪心; 从左往右枚举,设枚举到元素为x,并维护一个堆: 设此时堆顶元素为y, 如果x大于y,那么x可以与y产生差价,立即将差价贡献给答案。 如果y之前已经和其他元素z产生过差价了,那么y显然可以省出来以得到最优答案,因为x-z=x-y+y-z; 否则,把y移出堆... 阅读全文
posted @ 2016-10-31 22:07 hiweibolu 阅读(124) 评论(0) 推荐(0) 编辑
摘要: 题目描述数据范围解法枚举根之后,使用大除法。代码#include#include#include#include#include#define ll long longusing namespace std;const char* fin="equation.in";const c... 阅读全文
posted @ 2016-10-31 17:31 hiweibolu 阅读(142) 评论(0) 推荐(0) 编辑
摘要: 题目描述数据范围解法由于大于4的素数只有可能由奇数和偶数的和得出。 所以根据数的奇偶性可以分出两类数奇数和偶数。 奇数之间不会相互匹配,偶数之间也不会相互匹配。 那么原问题转化为二分图最大匹配。 网络流即可。代码#include#include#include#include#in... 阅读全文
posted @ 2016-10-31 17:29 hiweibolu 阅读(152) 评论(0) 推荐(0) 编辑
摘要: 题目描述解法搜索。代码#include#include#include#include#includeusing namespace std;const char* fin="mahjong.in";const char* fout="mahjong.out";const int ... 阅读全文
posted @ 2016-10-31 17:22 hiweibolu 阅读(221) 评论(0) 推荐(0) 编辑