基本的模板题,统计分子分母中p出现的次数,然后求逆元取模.//// main.cpp// fzu2020//// Created by 陈加寿 on 15/12/27.// Copyright (c) 2015年 chenhuan001. All rights reserved.//#inc...
分类:
其他好文 时间:
2015-12-27 23:25:11
阅读次数:
259
ploya定理+乘法逆元 1 #include 2 using namespace std; 3 #define maxn 65 4 #define maxs 25 5 int sr,sb,sg,n,m,p; 6 int a[maxn][maxn],f[maxs][maxs][maxs],vis.....
分类:
其他好文 时间:
2015-12-25 15:08:36
阅读次数:
250
1.扩展欧几里得求逆元typedef long long ll;//ax + by = gcd(a,b)//传入固定值a,b.放回 d=gcd(a,b), x , yvoid extendgcd(ll a,ll b,ll &d,ll &x,ll &y){ if(b==0){d=a;x=1;y=...
分类:
其他好文 时间:
2015-12-09 23:16:15
阅读次数:
178
AntTime Limit:1 Second Memory Limit:32768 KBThere is an ant named Alice. Alice likes going hiking very much. Today, she wants to climb a cuboid. The l...
分类:
其他好文 时间:
2015-11-30 02:15:36
阅读次数:
204
题目链接 :http://acm.hdu.edu.cn/showproblem.php?pid=4828Catalan数的公式为 C[n+1] = C[n] * (4 * n + 2) / (n + 2)题目要求对M = 1e9+7 取模利用乘法逆元将原式中除以(n+2)取模变为对(n+2)逆元的乘...
分类:
其他好文 时间:
2015-11-16 20:58:11
阅读次数:
175
这个公式推导过程是看的这位大牛的http://blog.csdn.net/bigbigship/article/details/49123643扩展欧几里德求模的逆元方法:#include #include #include using namespace std;typedef long long...
分类:
其他好文 时间:
2015-11-03 12:15:16
阅读次数:
266
Modular InverseTime Limit: 2 Seconds Memory Limit: 65536 KBThe modular modular multiplicative inverse of an integer a modulo m is an integer x such...
分类:
其他好文 时间:
2015-10-25 10:43:30
阅读次数:
323
AntTime Limit:1 Second Memory Limit:32768 KBThere is an ant named Alice. Alice likes going hiking very much. Today, she wants to climb a cuboid. The l...
分类:
其他好文 时间:
2015-10-18 23:08:13
阅读次数:
248
Happy 2004问题描述 :Consider a positive integer X,and let S be the sum of all positive integer divisors of 2004^X. Your job is to determine S modulo 29 (t...
分类:
移动开发 时间:
2015-10-18 20:05:47
阅读次数:
195
题目传送门题意:一个计算器,两种操作,乘上x,或者除掉之前的某个x,结果取模输出分析:因为取模不支持除法,然后比赛时想到用逆元,结果发现MOD需要与b互质,结果一直苦苦寻找求逆元的其它方法。后来队友用暴力方法竟然水过,具体操作是记录每次乘的x,如果除的话,将对应的x 改为1,然后一个一个乘。当然正解...
分类:
其他好文 时间:
2015-09-30 15:57:05
阅读次数:
169