##数学
文章平均质量分 63
GDRetop
这个作者很懒,什么都没留下…
展开
-
线性求逆元
线性求逆元1−1≡1(modp)1^{-1}\equiv1(mod\ p)令p=k∗i+r,r<i,1<i<pp=k*i+r,r<i,1<i<pk∗i+r≡0(modp)k*i+r \equiv 0 (mod\ p)两边同事乘上i−1∗r−1i^{-1}*r^{-1}得到k∗r−1+i−1≡0(modp)k*r^{-1}+i^{-1}\equiv0 (mod\ p)i−1≡−k∗原创 2015-10-05 20:06:54 · 2219 阅读 · 0 评论 -
Yandex.Algorithm Online Round 3 Sunday, June 15, 2014
Problem A. Distance 求树中距离恰好为2的结点对的个数#include#include#includeusing namespace std;int edge[100007];int main(){ int t; while(scanf("%d",&t)!=EOF){ for(int i = 1;i <= t; i++)原创 2015-08-14 16:30:43 · 1028 阅读 · 0 评论 -
hdu 2516 取石子游戏 博弈 斐波那契数
取石子游戏Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3381 Accepted Submission(s): 1981Problem Description1堆石子有n个,两人轮流取.先取者第1次原创 2015-08-13 10:49:37 · 690 阅读 · 0 评论 -
hdu 1079 Calendar Game 博弈
Calendar GameTime Limit: 5000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 3121 Accepted Submission(s): 1830Problem DescriptionAdam and Eve原创 2015-08-13 10:35:03 · 705 阅读 · 0 评论 -
CSU 1325: A very hard problem 莫比乌斯反演
1325: A very hard problemTime Limit: 3 Sec Memory Limit: 160 MBSubmit: 253 Solved: 58[Submit][Status][Web Board]DescriptionCX老湿经常被人黑,被黑得多了,自己也就麻木了。于是经常听到有人黑他,他都会深情地说一句:禽兽啊!一天CX原创 2015-08-07 18:45:14 · 905 阅读 · 0 评论 -
hdu 5212 code 容斥~或者莫比乌斯
CodeTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 489 Accepted Submission(s): 191Problem DescriptionWLD likes playing with原创 2015-07-31 20:18:15 · 650 阅读 · 0 评论 -
hdu 1695 GCD 莫比乌斯反演
GCDTime Limit: 6000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 7229 Accepted Submission(s): 2651Problem DescriptionGiven 5 integers: a, b原创 2015-07-31 19:34:21 · 844 阅读 · 0 评论 -
hdu 4746 Mophues 莫比乌斯反演
MophuesTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 327670/327670 K (Java/Others)Total Submission(s): 910 Accepted Submission(s): 345Problem DescriptionAs we know, any po原创 2015-07-31 16:39:46 · 818 阅读 · 0 评论 -
hdu 1402 A * B Problem Plus 快速傅里叶变换
A * B Problem PlusTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 14598 Accepted Submission(s): 2741Problem DescriptionCalcul原创 2015-07-26 13:32:41 · 812 阅读 · 0 评论 -
zoj 3329 One Person Game 动态规划,迭代法,二分
题意:给三个骰子,骰子有k1,k2,k3个面。每次掷骰子,得到的点数和为前进的步数,如果掷骰子的结果为c1,c2,c3(有序)则回到原点。从0点出发,到达大于N的点,则游戏结束。求掷骰子次数的期望。转移方程为: dp[i] = dp[i+l1+l2+l3]*(1/k1/k2/k3)+dp[0]*(1/k1/k2/k3)+1其中枚举l1,l2,l3为掷骰子得原创 2015-07-20 18:03:15 · 817 阅读 · 0 评论 -
曼哈顿距离最小生成树与莫队算法
一、曼哈顿距离最小生成树曼哈顿距离最小生成树问题可以简述如下:给定二维平面上的N个点,在两点之间连边的代价为其曼哈顿距离,求使所有点连通的最小代价。朴素的算法可以用O(N2)的Prim,或者处理出所有边做Kruskal,但在这里总边数有O(N2)条,所以Kruskal的复杂度变成了O(N2logN)。但是事实上,真正有用的边远没有O(N2)条。我们考虑每个点会和其他转载 2015-07-16 09:00:50 · 640 阅读 · 0 评论 -
hdu FSF’s game 欧拉定理,素数筛法
#include#include#includeusing namespace std;#define maxn 500007#define maxm 7000007#define uint unsigned intvectorhehe[maxn];uint copr[maxn],factor[maxn];uint next[maxm],val[maxm];uint cnt =原创 2014-08-13 12:39:58 · 785 阅读 · 0 评论 -
hdu 5072 Coprime 容斥原理
CoprimeTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 1460 Accepted Submission(s): 571Problem DescriptionThere are n peopl原创 2015-08-17 20:09:38 · 687 阅读 · 0 评论 -
hdu 5407 CRB and Candies 2015多校联合训练赛#10 找规律 素数筛法
CRB and CandiesTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 402 Accepted Submission(s): 185Problem DescriptionCRB has N di原创 2015-08-21 16:31:03 · 630 阅读 · 0 评论 -
hdu 3027 Saving Beans ,lucas定理
Saving BeansTime Limit: 6000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3112 Accepted Submission(s): 1177Problem DescriptionAlthough wint原创 2015-09-01 16:29:04 · 481 阅读 · 0 评论 -
hdu 4349 Xiao Ming's Hope,lucas定理
Xiao Ming's HopeTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1793 Accepted Submission(s): 1189Problem DescriptionXiao Ming原创 2015-09-01 18:54:13 · 546 阅读 · 0 评论 -
hdu 3944 DP? lucas定理
DP?Time Limit: 10000/3000 MS (Java/Others) Memory Limit: 128000/128000 K (Java/Others)Total Submission(s): 2460 Accepted Submission(s): 769Problem DescriptionFigure 1 shows t原创 2015-09-01 18:42:48 · 506 阅读 · 0 评论 -
hdu 5299 Circles Game 2015 Multi-University Training Contest 1 计算几何+博弈SG函数 圆的扫描线
Circles GameTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 251 Accepted Submission(s): 51Problem DescriptionThere are n circ原创 2015-07-22 12:01:38 · 1130 阅读 · 3 评论 -
hdu 5307 He is Flying 2015 Multi-University Training Contest 2 快速傅里叶变换
He is FlyingTime Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 91 Accepted Submission(s): 25Problem DescriptionJRY wants to dra原创 2015-07-24 20:50:26 · 1724 阅读 · 3 评论 -
hdu 5411 CRB and Puzzle 2015 多校联合训练赛#10 快速矩阵幂
CRB and PuzzleTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 69 Accepted Submission(s): 35Problem DescriptionCRB is now play原创 2015-08-20 20:18:45 · 898 阅读 · 1 评论 -
HDU 5863 cjj's string game 快速幂 dp
#include#include#include#include#includeusing namespace std;#define mod 1000000007#define maxn 22#define ll long longstruct Matrix{ int mat[22][22]; void init(){ memset(mat,0,原创 2016-08-21 12:34:40 · 523 阅读 · 0 评论 -
hdu 5490 Simple Matrix 递推公式+逆元+组合数
Simple MatrixTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 244 Accepted Submission(s): 85Problem DescriptionAs we know, seq原创 2015-10-05 22:01:52 · 1187 阅读 · 0 评论 -
高斯消元
http://www.cppblog.com/menjitianya/archive/2014/06/08/207226.html高斯消元算法目的: 高斯消元,一般用于求解线性方程组AX = B(或 模线性方程组AX mod P = B),以四个未知数,四个方程为例,AX=B表示成4x4的矩 阵和4x1的矩阵相乘的形式:转载 2015-10-05 13:19:09 · 1654 阅读 · 0 评论 -
hdu 5451 Best Solver 快速矩阵乘法 Fibonacci数列的循环节
Best SolverTime Limit: 1500/1000 MS (Java/Others) Memory Limit: 65535/102400 K (Java/Others)Total Submission(s): 401 Accepted Submission(s): 212Problem DescriptionThe so-called best原创 2015-09-22 21:54:10 · 1563 阅读 · 0 评论 -
hdu 2256 Problem of Precision 矩阵快速幂
Problem of PrecisionTime Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1057 Accepted Submission(s): 624Problem Description原创 2015-09-20 22:57:05 · 382 阅读 · 0 评论 -
hdu 5226 Tom and matrix,lucas定理
Tom and matrixTime Limit: 3000/1500 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 447 Accepted Submission(s): 136Problem DescriptionTom was on th原创 2015-09-01 19:26:40 · 512 阅读 · 0 评论 -
hdu 4305 Lightning 高斯消元 计算几何
这道题题意:有很多原创 2014-07-23 16:20:27 · 1000 阅读 · 0 评论