会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
Wisdom+.+
while(!Success)Try();
博客园
首页
新随笔
联系
管理
订阅
上一页
1
···
13
14
15
16
17
18
19
20
21
···
24
下一页
2017年10月19日
算法笔记--卢卡斯定理
摘要: Lucas定理是用来(当n和m和p很大时)求 C(n,m) mod p,p为素数的值。 表达式:C(n,m)%p=C(n/p,m/p)*C(n%p,m%p)%p。(可以递归) 递归方程:(C(n%p, m%p)*Lucas(n/p, m/p))%p。(递归出口为m==0,return 1) 模板:
阅读全文
posted @ 2017-10-19 15:55 Wisdom+.+
阅读(347)
评论(0)
推荐(0)
2017年10月14日
Codeforces 101487E - Enter The Dragon
摘要: 101487E - Enter The Dragon 思路:做的时候两个地方理解错了,第一个事我以为龙吸了水,水就干了,其实龙是在下雨之前吸的,下雨时湖水又满了,所以湖水永远不会干;第二个是以为只要找前面一段没下雨的天吸水就可以了,其实是上一次满了之后没下雨的天吸水都可以。 代码:
阅读全文
posted @ 2017-10-14 19:47 Wisdom+.+
阅读(252)
评论(0)
推荐(0)
2017年10月13日
算法笔记--2-sat
摘要: 强连通分量的应用,详见《挑战程序设计》P324 模板(2019.7): namespace two_sat { int dfn[M*2], low[M*2], cnt, stk[M*2], top, cmp[M*2], tot, n; bool vis[M*2]; vector<int> g[M*2
阅读全文
posted @ 2017-10-13 14:41 Wisdom+.+
阅读(306)
评论(2)
推荐(0)
2017年10月8日
算法笔记--图的存储之链式前向星
摘要: 链式前向星 这个博客写的不错:http://blog.csdn.net/acdreamers/article/details/16902023 模板: ①add_edge ②遍历以u节点为起点的所有边
阅读全文
posted @ 2017-10-08 14:34 Wisdom+.+
阅读(142)
评论(0)
推荐(0)
算法笔记--强连通分量分解
摘要: Kosaraju算法 详见《挑战程序设计竞赛》p320 模板: Tarjan算法模板: 例题1:POJ 2186 Popular Cows 代码: #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #i
阅读全文
posted @ 2017-10-08 14:01 Wisdom+.+
阅读(846)
评论(1)
推荐(0)
2017年10月4日
Uva 11995 I Can Guess the Data Structure!
摘要: Uva 11995 I Can Guess the Data Structure! 思路:队列,栈和优先队列的模拟。用STL更方便。 代码:
阅读全文
posted @ 2017-10-04 19:12 Wisdom+.+
阅读(180)
评论(0)
推荐(0)
2017年10月2日
算法笔记--米勒-罗宾素数测试
摘要: 由于伪素数的存在,费马素数测试有了极大的缺陷,于是有了米勒-拉宾素性测试。 写的不错的博客: http://blog.csdn.net/u013948191/article/details/47270979 http://www.cnblogs.com/kuangbin/archive/2012/0
阅读全文
posted @ 2017-10-02 21:33 Wisdom+.+
阅读(1011)
评论(0)
推荐(0)
HDU 5183 Negative and Positive (NP)
摘要: HDU 5183 Negative and Positive (NP) 思路:维护一下前缀和,从后往前向set里面插入前缀和,然后查找sum[i-1]+(-1)i+1*k在不在set里面。 代码(快读+set): 1466ms险过,用hash表应该快一点。
阅读全文
posted @ 2017-10-02 20:30 Wisdom+.+
阅读(169)
评论(0)
推荐(0)
算法笔记--快读(输入外挂)模板
摘要: 带多组的读入优化
阅读全文
posted @ 2017-10-02 19:53 Wisdom+.+
阅读(701)
评论(0)
推荐(0)
POJ 3258 River Hopscotch
摘要: POJ 3258 River Hopscotch 思路:二分最小距离。 代码:
阅读全文
posted @ 2017-10-02 14:29 Wisdom+.+
阅读(177)
评论(0)
推荐(0)
2017年9月30日
HDU 2289 Cup
摘要: HDU 2289 Cup 思路:二分。 代码:
阅读全文
posted @ 2017-09-30 19:32 Wisdom+.+
阅读(152)
评论(0)
推荐(0)
算法笔记--三分查找
摘要: 好菜啊,现在才学三分。 三分:查找凸形(凹形)函数的极大值(极小值)。 模板1: 模板2: 例题1:HDU 3714 Error Curves 代码:
阅读全文
posted @ 2017-09-30 18:59 Wisdom+.+
阅读(1265)
评论(0)
推荐(0)
96D - Police Stations
摘要: 96D - Police Stations 思路:bfs,从所有的警察局开始bfs,因为bfs的深度一样,而且题目给的树保证满足条件,所以不用考虑深度。 如果搜索到一个点a,他的下一个点b已经被搜索过了,而且a到b这条路没有被走过,那么这条路可以被砍掉。 不能用dfs,这样可能导致某些点搜索不到,反
阅读全文
posted @ 2017-09-30 11:52 Wisdom+.+
阅读(334)
评论(0)
推荐(0)
2017年9月29日
554C - Kyoya and Colored Balls
摘要: 554C - Kyoya and Colored Balls 思路:组合数,用乘法逆元求。 代码:
阅读全文
posted @ 2017-09-29 16:46 Wisdom+.+
阅读(223)
评论(0)
推荐(0)
2017年9月27日
算法笔记--java的BigInteger类及BigDecimal类
摘要: 引包:import java.math.*; BigInteger类: 可以使用构造方法:public BigInteger(String val),或者valueOf(int)函数,如: 也可以直接读入,如: 基本操作: BigDecimal类:参见博客:http://blog.csdn.net/
阅读全文
posted @ 2017-09-27 20:57 Wisdom+.+
阅读(316)
评论(0)
推荐(0)
2017年9月25日
Codeforces 855B - Marvolo Gaunt's Ring
摘要: 855B - Marvolo Gaunt's Ring 思路:①枚举a[j],a[i]和a[k]分别用前缀最小值最大值和后缀最小值和后缀最大值确定。 ②dp,dp[i][j]表示到第j为止,前i+1个值加起来的最大值。 代码: 代码①: 代码②:
阅读全文
posted @ 2017-09-25 15:23 Wisdom+.+
阅读(358)
评论(0)
推荐(0)
2017年9月22日
610D - Vika and Segments(线段树+扫描线+离散化)
摘要: 扫描线:http://www.cnblogs.com/scau20110726/archive/2013/04/12/3016765.html 看图,图中的数字是横坐标离散后对应的下标,计算时左端点不变,右端点加1,所以总的更新的区间是l到r-1。 也可以理解为1代表的是(1到2这一段),2代表的是
阅读全文
posted @ 2017-09-22 16:39 Wisdom+.+
阅读(264)
评论(0)
推荐(0)
2017年9月21日
Codeforces 861D - Polycarp's phone book
摘要: 861D - Polycarp's phone book 思路:用map做的话,只能出现一次循环,否则会超时。 代码:
阅读全文
posted @ 2017-09-21 16:55 Wisdom+.+
阅读(277)
评论(0)
推荐(0)
Codeforces 862B - Mahmoud and Ehab and the bipartiteness
摘要: 862B - Mahmoud and Ehab and the bipartiteness 思路:先染色,然后找一种颜色dfs遍历每一个点求答案。 代码:
阅读全文
posted @ 2017-09-21 16:52 Wisdom+.+
阅读(181)
评论(0)
推荐(0)
Codeforces 862C - Mahmoud and Ehab and the xor
摘要: 862C - Mahmoud and Ehab and the xor 思路:找两对异或后等于(1<<17-1)的数(相当于加起来等于1<<17-1),两个再异或一下就变成0了,0异或x等于x。所以只要把剩下的异或起来变成x就可以了。如果剩下来有3个,那么,这3个数可以是x^i^j,i,j。 代码:
阅读全文
posted @ 2017-09-21 16:49 Wisdom+.+
阅读(248)
评论(0)
推荐(0)
上一页
1
···
13
14
15
16
17
18
19
20
21
···
24
下一页
公告