1 2 3 4
上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 20 下一页
摘要: https://leetcode-cn.com/problems/count-all-possible-routes/ dp[x][y]从x到终点,使用y的油。 具体看注释 #include<iostream> #include<algorithm> #include<cstring> #inclu 阅读全文
posted @ 2020-09-08 19:29 Lesning 阅读(221) 评论(0) 推荐(0)
摘要: https://ac.nowcoder.com/acm/contest/5671/J 牛客多校j题,利用线段树nlogn写出模拟的操作快速幂 可以类似给转圈用 #include<iostream> #include<set> using namespace std; typedef long lon 阅读全文
posted @ 2020-09-07 19:43 Lesning 阅读(132) 评论(0) 推荐(0)
摘要: https://ac.nowcoder.com/acm/contest/7225/A 一句话,按照list转一圈,把list按照list转之后就是转两圈,快速幂的思想 #include<iostream> #include<algorithm> #include<cstring> #include< 阅读全文
posted @ 2020-09-05 20:38 Lesning 阅读(194) 评论(0) 推荐(0)
摘要: 博弈论 https://codeforces.com/contest/1397/problem/D 如果随便取走,只要是奇数就是先手赢,现在他规定不能重复取前人取过的,那就意味着8 2 2 2 ,先手占领8,就必胜了,如果4 4 4 4 4 这样均势,a先手每次找最大的取,只要是奇数就能赢 想不到啊 阅读全文
posted @ 2020-09-04 17:00 Lesning 阅读(223) 评论(0) 推荐(0)
摘要: https://ac.nowcoder.com/acm/contest/7079/C 由题可知是最小生成树,先把比L【i】小的连通块建立好,合并集合x,y可得 》 par[y] = x,ans += siz[x]*siz[y],siz[x] += siz[y]; #include<iostream> 阅读全文
posted @ 2020-09-03 22:24 Lesning 阅读(248) 评论(0) 推荐(0)
摘要: https://codeforces.com/contest/1400/problem/D i<j<k<l 假设x = list【j】 y = list【k】 可以枚举j和k,0 j-1有a个y,k+1 -- n有b个x,ans+=a*b枚举就好了 具体看代码 #include<iostream> 阅读全文
posted @ 2020-09-03 21:25 Lesning 阅读(210) 评论(0) 推荐(0)
摘要: https://codeforces.com/contest/1400/problem/B 有一点很重要,s能用完就一定会用完,枚举我用几个s就好 #include<iostream> #include<cstring> #include<queue> #include<algorithm> usi 阅读全文
posted @ 2020-09-03 15:17 Lesning 阅读(210) 评论(0) 推荐(0)
摘要: 树上启发式合并 枚举每个数字的所有因子,存起来 官方题解传送门 https://ac.nowcoder.com/discuss/485120?type=101&order=0&pos=2&page=1&channel=-1&source_id=1 题目传送门 https://ac.nowcoder. 阅读全文
posted @ 2020-08-24 23:10 Lesning 阅读(187) 评论(0) 推荐(0)
摘要: https://ac.nowcoder.com/acm/contest/5205/B 他给你的算法可以转换成重0,0除法到x,y有多少种走法在t个时间里,每个时间选择上,右或者不动 C(t,x+y)*C(x+y,x) #include<iostream> #include<algorithm> #i 阅读全文
posted @ 2020-08-23 18:07 Lesning 阅读(145) 评论(0) 推荐(0)
摘要: https://ac.nowcoder.com/acm/contest/6037/F 很诡异,对于8 3 2 1 1这种,答案是7(3+2+1+1), 对于6 5 4 3 2 1这种,是(6+5+4+3+2+1)/2 所以求出每种颜色的最大数量 还有颜色总数就能在O(1)算出来一棵树了。但是吧。。。 阅读全文
posted @ 2020-08-20 17:30 Lesning 阅读(146) 评论(0) 推荐(0)
上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 20 下一页