
模板
红点雷龙XL
这个作者很懒,什么都没留下…
展开
-
【POJ】3630Phone List(字典树插入判断)
Time Limit:1000MS Memory Limit:65536K Total Submissions:36003 Accepted:10269 DescriptionGiven a list of phone numbers, determine if it is consistent in the sense that no numb...原创 2019-04-05 10:32:23 · 152 阅读 · 0 评论 -
【HDU】2222Keywords Search(AC自动机模板)
Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 131072/131072 K (Java/Others) Total Submission(s): 81386Accepted Submission(s): 28398 Problem Description In the modern time,...原创 2019-03-10 19:46:10 · 162 阅读 · 0 评论 -
【HDU】1530Maximum Clique(求最大团,模板题目)
Time Limit: 20000/10000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 5719 Accepted Submission(s): 2927 Problem Description Given a graph G(V, E)...原创 2019-01-23 21:05:16 · 285 阅读 · 0 评论 -
【HDU】1756Cupid's Arrow(判断:点在多边形内 模板题目)
Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 3177 Accepted Submission(s): 1142 Problem Description 传说世上有一支丘比特的箭,凡是被这支箭射到的人...原创 2019-01-16 20:19:00 · 231 阅读 · 0 评论 -
拓展卢卡斯定理(p非质数情况)
转自:https://blog.youkuaiyun.com/qq_40679299/article/details/80495032再看下面讲解之前,请大家熟悉一下乘法逆元,中国剩余定理,拓展gcd,费马小定理 关于拓展卢卡斯,也就是卢卡斯的升级版,卢卡斯限定只能取余一个素数,而拓展卢卡斯则没有限定其求解方法如下:若不是素数,将p分解质因数,将C(n,m)分别按照Lucas定理中的方法求对p的...转载 2018-09-24 21:14:06 · 393 阅读 · 0 评论 -
【POJ】2084Game of Connections(大数的卡特兰数处理)
Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 9193 Accepted: 4506 DescriptionThis is a small but ancient game. You are supposed to write down the numbers 1, 2, 3, . ...原创 2018-08-15 11:40:34 · 323 阅读 · 0 评论 -
【POJ】1306Combinations-组合数
Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 10217 Accepted: 4658 DescriptionComputing the exact number of ways that N things can be taken M at a time can be a grea...原创 2018-08-15 09:52:15 · 173 阅读 · 0 评论 -
【HDU】4059 The Boss on Mars-容斥原理+逆元+快速幂+质因子分解+四次方程求和公式
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 3297 Accepted Submission(s): 1084 Problem Description On Mars, there is a hug...原创 2018-08-14 22:07:00 · 223 阅读 · 0 评论 -
【POJ】3370Halloween treats鸽巢原理
Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 9405 Accepted: 3365 Special Judge DescriptionEvery year there is the same problem at Halloween: Each neighbour ...原创 2018-08-14 20:18:06 · 198 阅读 · 0 评论 -
【POJ】2356-Find a multiple-鸽巢原理
Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 9080 Accepted: 3896 Special Judge DescriptionThe input contains N natural (i.e. positive integer) numbers ( N &...原创 2018-08-14 19:22:34 · 162 阅读 · 0 评论 -
【组合数学】求C(n,m)%mod的方法总结
转载自:https://blog.youkuaiyun.com/u010582475/article/details/47707739求C(n,m)%mod的方法总结1.当n,m都很小的时候可以利用杨辉三角直接求。 C(n,m)=C(n-1,m)+C(n-1,m-1);2.利用乘法逆元。 乘法逆元:(a/b)%mod=a*(b^(mod-2)) mod为素数。 逆元可以利用扩展欧几里德或欧拉...转载 2018-08-14 16:44:02 · 1523 阅读 · 0 评论 -
ACM求组合数的几种方法总结
1.直接计算代码:#include<iostream>#include<algorithm>#include<cstring>#include<cstdio>#include<cmath>#include<queue>#include<vector>#define LL long long转载 2018-08-14 16:39:31 · 3698 阅读 · 0 评论 -
【HDU】4349Xiao Ming's Hope-Lucas定理推导
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 2618 Accepted Submissio...原创 2018-08-14 15:24:12 · 183 阅读 · 0 评论 -
【HDU】1205 吃糖果-抽屉原理,鸽巢原理
Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others) Total Submission(s): 47459 Accepted Submission(s): 13538 Problem Description HOHO,终于从Speakless手上赢走...原创 2018-08-14 11:26:14 · 304 阅读 · 0 评论 -
【HDU】1695 GCD(容斥原理+线形欧拉函数)
Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 15373 Accepted Submiss...原创 2018-08-14 10:10:10 · 232 阅读 · 0 评论 -
【HDU】1796 How many integers can you find容斥原理求解(dfs方法)
Time Limit: 12000/5000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 10810 Accepted Submission(s): 3213 Problem Description Now you get a numbe...原创 2018-08-13 20:40:46 · 203 阅读 · 0 评论 -
【HDU】4135Co-prime-质数分解+容斥原理+二进制枚举
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 7488 Accepted Submissi...原创 2018-08-13 11:16:55 · 228 阅读 · 0 评论 -
【HDU】2067-小兔的棋盘
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 12794 Accepted Submissi...原创 2018-08-13 10:02:08 · 344 阅读 · 0 评论 -
POJ3358Period of an Infinite Binary Expansion-欧拉定理最小解问题
Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 3711 Accepted: 1051 DescriptionLet {x} = 0.a1a2a3... be the binary representation of the fractional part of a rational ...原创 2018-08-11 11:54:49 · 264 阅读 · 0 评论 -
POJ2034Anti-prime Sequences--dfs
Time Limit: 3000MS Memory Limit: 30000K Total Submissions: 4127 Accepted: 1857 DescriptionGiven a sequence of consecutive integers n,n+1,n+2,...,m, an anti-prime sequence is a re...原创 2018-08-11 08:26:27 · 212 阅读 · 0 评论 -
POJ3641Pseudoprime numbers-快速幂的使用
Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 12457 Accepted: 5363 DescriptionFermat's theorem states that for any prime number p and for any integer a > 1, ap = ...原创 2018-08-10 19:18:05 · 130 阅读 · 0 评论 -
素数的线形筛法模板
#include<iostream>#include<cstdio>#include<cstring>#define maxn 10005using namespace std;int prime[maxn],num_prime=0;int cnt[maxn]; //值为0则为素数int vis[maxn]={1,1};int main(...原创 2018-08-10 16:28:38 · 187 阅读 · 0 评论 -
POJ2773 Happy 2006-2种题解方法
题目链接:http://poj.org/problem?id=2773题目大意:给定一个n要求出这个从0到n的第k个与n互质的数, 第一种:举个例子,一个数,比如n,若从1~n上与n互质的数有p个,则从n+1~2*n上也必然会有p个(可以拿单个数想一想,其实我也不会证明),则1~2*n上就有2*p个与其互质的数,同样的,1~m*n上就有m*p个与n互质的数。这...原创 2018-08-10 15:30:22 · 263 阅读 · 1 评论 -
poj2407Relatives欧拉函数求解模板
DescriptionGiven n, a positive integer, how many positive integers less than n are relatively prime to n? Two integers a and b are relatively prime if there are no integers x > 1, y > 0, z >...原创 2018-08-09 21:07:33 · 184 阅读 · 0 评论 -
母函数及其模板例题总结
首先:在数学中,某个序列的母函数(Generating function,又称生成函数)是一种形式幂级数,其每一项的系数可以提供关于这个序列的信息。使用母函数解决问题的方法称为母函数方法。母函数可分为很多种,包括普通母函数、指数母函数、L级数、贝尔级数和狄利克雷级数。对每个序列都可以写出以上每个类型的一个母函数。构造母函数的目的一般是为了解决某个特定的问题,因此选用何种母函数视乎序列本身的...原创 2018-08-05 23:09:12 · 702 阅读 · 0 评论 -
The Cow Prom -Tarjan求强连通分量-模板
题目描述The N (2 <= N <= 10,000) cows are so excited: it's prom night! They are dressed in their finest gowns, complete with corsages and new shoes. They know that tonight they will each try to pe...原创 2018-07-29 16:12:36 · 173 阅读 · 0 评论