摘要: 题意:http://codeforces.com/problemset/problem/1096/D 思路:参考:https://blog.csdn.net/qq_41289920/article/details/100715683 阅读全文
posted @ 2019-10-24 21:57 ZMWLxh 阅读(152) 评论(0) 推荐(0) 编辑
摘要: 题意:http://acm.hdu.edu.cn/showproblem.php?pid=1565 取不相邻的点是权值最大。 这题可以网络流做,暂时先DP一下,网络流明天学一下~~ 阅读全文
posted @ 2019-10-22 22:21 ZMWLxh 阅读(218) 评论(0) 推荐(0) 编辑
摘要: 题意:http://acm.hdu.edu.cn/showproblem.php?pid=1540 写了我老久 阅读全文
posted @ 2019-10-21 16:04 ZMWLxh 阅读(180) 评论(0) 推荐(0) 编辑
摘要: 题意:https://vjudge.net/contest/336100#problem/B HDU6231 阅读全文
posted @ 2019-10-20 10:56 ZMWLxh 阅读(212) 评论(0) 推荐(0) 编辑
摘要: 题意:https://www.luogu.org/problem/P3919 阅读全文
posted @ 2019-10-19 13:14 ZMWLxh 阅读(154) 评论(0) 推荐(0) 编辑
摘要: 题意:https://www.nitacm.com/problem_show.php?pid=1470 阅读全文
posted @ 2019-10-17 21:49 ZMWLxh 阅读(255) 评论(0) 推荐(0) 编辑
摘要: 题意:https://www.nitacm.com/problem_show.php?pid=1378 如题。 思路: 从第一行for到最后一行,枚举每一行的所有状态,进行转移,注意答案是dp【最后一行】【0】,因为最后一行是唯一确定的。 https://blog.csdn.net/Tc_To_To 阅读全文
posted @ 2019-10-16 22:23 ZMWLxh 阅读(327) 评论(0) 推荐(0) 编辑
摘要: 题意:https://ac.nowcoder.com/acm/contest/1111/D 问你先减二x次的情况下,最少减几次3。 思路: %3不为0的要先减2,然后%3为0的要先减大的(比如9 3 3 会比3 3 9 更优) 阅读全文
posted @ 2019-10-08 21:44 ZMWLxh 阅读(227) 评论(0) 推荐(0) 编辑
摘要: 题意:https://ac.nowcoder.com/acm/contest/1109/C 问你有几个x满足A,B集合都能XOR出x。 思路: 就是线性基求交后,有几个基就是2^几次方。 阅读全文
posted @ 2019-10-04 19:05 ZMWLxh 阅读(252) 评论(0) 推荐(0) 编辑
摘要: 题意:https://ac.nowcoder.com/acm/contest/881/I 给你n个平面上的点,每个点有a、b两个权值,现在让你划分成两个区域(要求所有A集合里的点不能在任何B集合里的点的右下方)。 求MAX(Sigma ai+Sigma bi)。 思路: dp+线段树。 https: 阅读全文
posted @ 2019-10-04 10:52 ZMWLxh 阅读(265) 评论(0) 推荐(0) 编辑
摘要: 题意:https://codeforces.com/group/ikIh7rsWAl/contest/254825/problem/E 给你一个n,计算n / Sigma(1~n)的d(是n的只出现一次的因数)。 思路: 反正就是打表找规律,3组数据也能找规律,你们是真的nb嗷。 阅读全文
posted @ 2019-10-03 19:11 ZMWLxh 阅读(406) 评论(0) 推荐(0) 编辑
摘要: 题意:https://ac.nowcoder.com/acm/contest/1107/J n个点的完全图编号0-n-1,第i个点的权值为2^i,原先是先手选取一些边,然后后手选取一些点,满足先手选取的所有边对应的两点至少要有一个,并且总的权值和最少,现在给你后手选取的点得权值和,求先手选取边的方案 阅读全文
posted @ 2019-10-02 20:06 ZMWLxh 阅读(266) 评论(0) 推荐(0) 编辑
摘要: 1 #define IOS ios_base::sync_with_stdio(0); cin.tie(0); 2 #include <cstdio>//sprintf islower isupper 3 #include <cstdlib>//malloc exit strcat itoa system("cls") 4 #include <iostream>//pair 5 #include 阅读全文
posted @ 2019-09-30 21:45 ZMWLxh 阅读(262) 评论(0) 推荐(0) 编辑
摘要: 题意:http://acm.hdu.edu.cn/showproblem.php?pid=6739 尽量让他们连起来。 思路: 直接dp,其中一个状态是以什么结尾。 阅读全文
posted @ 2019-09-28 21:46 ZMWLxh 阅读(412) 评论(0) 推荐(0) 编辑
摘要: 题意:http://acm.hdu.edu.cn/showproblem.php?pid=6736 沙漠中的每一个连通块都是一棵仙人掌;一个连通块是一棵仙人掌当且仅当连通块中不存在重边和自环,并且每一条边仅被至多一个简单环覆盖。经过一番评估,Z 国决定通过删去沙漠中的一些边,最终将沙漠变为森林。这里 阅读全文
posted @ 2019-09-28 21:44 ZMWLxh 阅读(541) 评论(4) 推荐(0) 编辑
摘要: 题意:https://codeforc.es/contest/1208/problem/E 现有n行w列的墙,每行有一排连续方块,一排方块可以左右连续滑动,且每个方块都有一个价值,第i 列的价值定义为这列的方块的价值和。求1到w列中每列的最大价值。注:如果一个位置没有方块,那么这个位置的价值为0 思 阅读全文
posted @ 2019-09-27 21:00 ZMWLxh 阅读(215) 评论(0) 推荐(0) 编辑
摘要: 题意:https://codeforc.es/contest/1208/problem/D 给你长度为n的序列,s[i]的值为p[1]到p[i-1]中比p[i]小的数的和,让你求出p序列。 思路: 首先我们要想到,最后一个0的位置一定就是当前剩余还没用确定的数里的最小值,所以从1,2,3 。。。一直 阅读全文
posted @ 2019-09-27 19:34 ZMWLxh 阅读(214) 评论(0) 推荐(0) 编辑
摘要: 题意:https://codeforc.es/contest/1208/problem/C 如题;就是给定一个数n,要你求一个n×n的矩阵,矩阵中的元素是 0 ~ n2-1 ,使得矩阵每一行和每一列的元素异或之后的结果相等。 https://blog.csdn.net/m0_38055352/art 阅读全文
posted @ 2019-09-26 20:17 ZMWLxh 阅读(467) 评论(0) 推荐(0) 编辑
摘要: https://www.nitacm.com/problem_show.php?pid=8314 思路:类似于https://blog.csdn.net/MIKASA3/article/details/51523563 阅读全文
posted @ 2019-09-25 20:27 ZMWLxh 阅读(333) 评论(0) 推荐(0) 编辑
摘要: 1 #define IOS ios_base::sync_with_stdio(0); cin.tie(0); 2 #include <cstdio>//sprintf islower isupper 3 #include <cstdlib>//malloc exit strcat itoa system("cls") 4 #include <iostream>//pair 5 #include 阅读全文
posted @ 2019-09-24 22:20 ZMWLxh 阅读(336) 评论(0) 推荐(0) 编辑
摘要: 1 #define IOS ios_base::sync_with_stdio(0); cin.tie(0); 2 #include <cstdio>//sprintf islower isupper 3 #include <cstdlib>//malloc exit strcat itoa system("cls") 4 #include <iostream>//pair 5 #include 阅读全文
posted @ 2019-09-23 21:28 ZMWLxh 阅读(244) 评论(0) 推荐(0) 编辑
摘要: 题意: 给你S串和T串,用T串的所有前缀去匹配S串(匹配值是最长公共子串)。 问你总值相加是多少。 思路: 先把两个S,T串倒过来,再拼接 S#T 合成一串,跑一下后缀数组 在排序好的rank里计算每个T后缀的最长匹配长度。(前后两个for即可) 最后dp对后缀取max,累计答案。(因为后缀从pos 阅读全文
posted @ 2019-09-21 14:08 ZMWLxh 阅读(529) 评论(0) 推荐(0) 编辑
摘要: 题意:https://codeforc.es/problemset/problem/1209/E2 给你一个n(1-12)行m(1-2000)列的矩阵,每一列都可以上下循环移动(类似密码锁)。 问你移动后,对每一行取最大值,这些最大值再加起来的MAX是多少。 思路: 1. 首先我们有一个思维上的优化 阅读全文
posted @ 2019-09-18 16:33 ZMWLxh 阅读(184) 评论(0) 推荐(0) 编辑
摘要: 题意:https://nanti.jisuanke.com/t/41420 给你n个石子的重量,要求满足(Sum<=2*sum<=Sum+min)的方案数,min是你手里的最小值。 思路: 从最大重量的石子开始背包,每次ans+=dp【j-v【i】】就行了。 阅读全文
posted @ 2019-09-17 18:41 ZMWLxh 阅读(271) 评论(0) 推荐(0) 编辑
摘要: 题意:https://nanti.jisuanke.com/t/41422 对每一位进行找循环节规律就行了。 阅读全文
posted @ 2019-09-17 18:36 ZMWLxh 阅读(160) 评论(0) 推荐(0) 编辑
摘要: 题意:https://codeforc.es/contest/1209/problem/D 有n个点心,有k个人,每个人都有喜欢的两个点心,现在给他们排个队,一个一个吃,每个人只要有自己喜欢的点心就会吃掉(不会留给后面的人)。 如果有人什么都没吃就会不开心,问怎么安排使不开心的人最少。 思路: 看成 阅读全文
posted @ 2019-09-16 20:35 ZMWLxh 阅读(279) 评论(0) 推荐(0) 编辑
摘要: https://hihocoder.com/problemset/problem/1430 思路: 要用前缀去推Sigma总公式,比较方便。https://blog.csdn.net/weixin_37517391/article/details/83821752 阅读全文
posted @ 2019-09-14 10:17 ZMWLxh 阅读(321) 评论(0) 推荐(0) 编辑
摘要: 见:https://blog.csdn.net/dormousenone/article/details/75208903 阅读全文
posted @ 2019-09-13 18:46 ZMWLxh 阅读(480) 评论(0) 推荐(0) 编辑
摘要: 1 #define IOS ios_base::sync_with_stdio(0); cin.tie(0); 2 #include <cstdio>//sprintf islower isupper 3 #include <cstdlib>//malloc exit strcat itoa system("cls") 4 #include <iostream>//pair 5 #include 阅读全文
posted @ 2019-09-12 19:11 ZMWLxh 阅读(181) 评论(0) 推荐(0) 编辑
摘要: 题意:https://codeforc.es/problemset/problem/195/D 求折线段数。 思路: 对pos进行sort,对不同区间段加k,两个dp处理不同k>0 or k<0前后缀,判断即可。 注意:long double,ESP=1e-20。 阅读全文
posted @ 2019-09-11 20:58 ZMWLxh 阅读(204) 评论(0) 推荐(0) 编辑
摘要: 题意:https://nanti.jisuanke.com/t/41355 给出N1,计算公式:A=F(N)Ni=Ni-1 ^ (A*A),F为类斐波那契需要矩阵快速幂的递推式。 求第k个N。 思路: 发现从大约1e5个数开始N交替出现,到一定位置%2即可。(or正解:https://blog.cs 阅读全文
posted @ 2019-09-09 18:46 ZMWLxh 阅读(185) 评论(0) 推荐(0) 编辑
摘要: 直接模拟orhttps://blog.csdn.net/liufengwei1/article/details/100643831 阅读全文
posted @ 2019-09-09 18:38 ZMWLxh 阅读(174) 评论(0) 推荐(0) 编辑
摘要: https://nanti.jisuanke.com/t/4 1389 解: 字符串hash二分跑回文串。 阅读全文
posted @ 2019-09-07 19:13 ZMWLxh 阅读(259) 评论(0) 推荐(0) 编辑
摘要: https://nanti.jisuanke.com/t/41387 解: 离散化+线段树。 阅读全文
posted @ 2019-09-07 19:10 ZMWLxh 阅读(279) 评论(0) 推荐(0) 编辑
摘要: https://nanti.jisuanke.com/t/41383 解: 斐波那契博弈+中国剩余定理。 阅读全文
posted @ 2019-09-07 19:06 ZMWLxh 阅读(204) 评论(0) 推荐(0) 编辑
摘要: 题意:https://codeforc.es/contest/1217/problem/D 给你一个有向图,要求一个循环里不能有相同颜色的边,问你最小要几种颜色染色,怎么染色? 思路: 如果没有环,那全是1;如果有环,那小到大的边为1,大到小的边为2。 阅读全文
posted @ 2019-09-07 09:49 ZMWLxh 阅读(317) 评论(0) 推荐(0) 编辑
摘要: 引用:https://blog.csdn.net/qq_41879343/article/details/100565031 下面代码写错了,注意要上面这种。查:2 800 0,下面代码就错了。 阅读全文
posted @ 2019-09-05 20:30 ZMWLxh 阅读(206) 评论(0) 推荐(0) 编辑
摘要: 题意:https://codeforc.es/contest/1207/problem/E 答案guessing(0~2^14-1) 有两次机会,内次必须输出不同的100个数,每次系统会随机挑一个你给的数,告诉你答案XOR这个数的值。 问你这个答案是多少。 思路: 先输出100个前7位位0的数,再输 阅读全文
posted @ 2019-09-05 18:43 ZMWLxh 阅读(205) 评论(0) 推荐(0) 编辑
摘要: 题意:https://codeforc.es/contest/1214/problem/E 有2n个点,每个2*i和2*i-1的距离必须是Di(<=n),现在让你构造这个树。 思路: 因为Di小于等于n,所以先对Di从大到小排序,把左端点排成一排,然后右端点搞搞就行。 注意:如果右端点应该插到最后一 阅读全文
posted @ 2019-09-05 15:28 ZMWLxh 阅读(286) 评论(0) 推荐(0) 编辑
摘要: 题意:https://codeforc.es/contest/1214/problem/D 给你一个n*m的图,每次可以往右或者往下走,问你使(1,1)不能到(n,m)最少要放多少 ‘ # ’ 。 思路: 最多是2,不能到(n,m)是0,接下来就是判断1。 也就是判断有没有一个点所有路径必须经过。 阅读全文
posted @ 2019-09-04 21:45 ZMWLxh 阅读(256) 评论(0) 推荐(0) 编辑