随笔分类 - 算法
摘要:Description TT and FF are ... friends. Uh... very very good friends ________ b FF is a bad boy, he is always wooing TT to play the following game with
阅读全文
摘要:cf上一道题,不知道前缀和怎么也找不到做法。 其实是二分检查时用到前缀和,代码如下: c++ include include include include include include include using namespace std; typedef long long ll; cons
阅读全文
posted @ 2019-03-11 19:11
见风仍是风
摘要:Description Mr.Dog was fired by his company. In order to support his family, he must find a new job as soon as possible. Nowadays, It's hard to have a
阅读全文
摘要:做了NOIP的题,是动态规划背包问题的典例。 采药 输入格式: 第一行有2个整数T(1≤T≤1000)和M(1≤M≤100),用一个空格隔开,T代表总共能够用来采药的时间,M代表山洞里的草药的数目。 接下来的M行每行包括两个在1到100之间(包括1和100)的整数,分别表示采摘某株草药的时间和这株草
阅读全文
posted @ 2019-03-01 00:21
见风仍是风
摘要:并查集是将元素按需要进行集合合并及查找的方法,使用数组pre[x]表示x的上级元素。 1.查找。 可用pre[x]==x来表示x为该集合的根,用根来做这个集合的代表,查找时使用递归找到根判断该元素所在集合。 2.合并。 只需将一个集合的根设为另一个集合的上级就可以完成两个集合的合并。 但有很大的可能
阅读全文

浙公网安备 33010602011771号