上一页 1 ··· 18 19 20 21 22 23 24 25 26 ··· 29 下一页
摘要: 卷积计数。 将所有面值的硬币写成多项式形式,用系数表示硬币个数,用指数表示硬币面值,则卷积一遍后系数相加,相同系数的式子累积,则再扫一遍后第一个系数为0的位置的系数便是答案。 1 #include <iostream> 2 #include <algorithm> 3 #include <cstdi 阅读全文
posted @ 2017-02-10 10:36 KingSann 阅读(114) 评论(0) 推荐(0) 编辑
摘要: 竟然还有丧心病狂的题考费马大定理。。。 费马大定理: 当整数 $n>2$ 时,关于 $x, y, z$ 的方程 $x^n + y^n = z^n$ 没有正整数解。 当 $n=1$ 的时候,显然 $x=1,y=2,z=3$ 是符合题意的。。 当 $n=2$ 的时候,打个表就能发现答案是勾三股四弦五。。 阅读全文
posted @ 2017-02-09 13:52 KingSann 阅读(215) 评论(0) 推荐(0) 编辑
摘要: 差分约束上的最长路问题。。。 阅读全文
posted @ 2017-02-08 19:12 KingSann 阅读(75) 评论(0) 推荐(0) 编辑
摘要: http://blog.csdn.net/wzq_qwq/article/details/48155921 1 #include <iostream> 2 #include <algorithm> 3 #include <cstdio> 4 #include <cstring> 5 #include 阅读全文
posted @ 2017-02-07 22:13 KingSann 阅读(112) 评论(0) 推荐(0) 编辑
摘要: QAQ再练一波。。 1 #include <iostream> 2 #include <algorithm> 3 #include <cstdio> 4 #include <cstring> 5 #include <cstdlib> 6 #include <string> 7 #include <v 阅读全文
posted @ 2017-02-07 21:11 KingSann 阅读(129) 评论(0) 推荐(0) 编辑
摘要: 再次练习FFT模板。。。 1 #include <iostream> 2 #include <algorithm> 3 #include <cstdio> 4 #include <cstring> 5 #include <cstdlib> 6 #include <complex> 7 using n 阅读全文
posted @ 2017-02-07 17:19 KingSann 阅读(120) 评论(0) 推荐(0) 编辑
摘要: 换了一种模板。。。 1 #include <iostream> 2 #include <algorithm> 3 #include <cstdio> 4 #include <cstring> 5 #include <cstdlib> 6 #include <complex> 7 using name 阅读全文
posted @ 2017-02-07 16:42 KingSann 阅读(99) 评论(0) 推荐(0) 编辑
摘要: 可以这很傅立叶。 1 #include <iostream> 2 #include <algorithm> 3 #include <cstdio> 4 #include <cstring> 5 #include <cstdlib> 6 #include <string> 7 #include <ve 阅读全文
posted @ 2017-02-07 11:06 KingSann 阅读(98) 评论(0) 推荐(0) 编辑
摘要: 正解:dfs一遍然后根据边两边颜色不同乱搞。 可惜我不会。 想了想后发现,如果要求一个节点,使得所有子树纯色的话,把它搞成一个序列不就好办了。 于是就想到了欧拉序列——每一棵子树在欧拉序列上都是一段连续的空间。 那么就可以把这棵树映射到序列上了。 然后就可以暴力枚举每一个节点,然后暴力枚举所有子树了 阅读全文
posted @ 2017-02-05 11:30 KingSann 阅读(211) 评论(0) 推荐(0) 编辑
摘要: 判断一个数字是否能分成两个整数。 1 #include <iostream> 2 #include <algorithm> 3 #include <cstdio> 4 #include <cstring> 5 #include <cstdlib> 6 #include <queue> 7 #incl 阅读全文
posted @ 2017-02-01 19:46 KingSann 阅读(84) 评论(0) 推荐(0) 编辑
上一页 1 ··· 18 19 20 21 22 23 24 25 26 ··· 29 下一页