c++ 快速幂与取模
碳酸钙的01妖精
这个作者很懒,什么都没留下…
展开
-
快速幂与取模小结
取模公式 1)a≡a(mod d) 2)对称性 a≡b(mod d)→b≡a(mod d) 3)传递性 (a≡b(mod d),b≡c(mod d))→a≡c(mod d) 如果a≡x(mod d),b≡m(mod d),则 4)a+b≡x+m (mod d) 5)a-b≡x-m (mod d) ...原创 2018-06-20 12:01:00 · 171 阅读 · 0 评论 -
D. Holidays(C(n,m)和杨辉三角的模)
Everyone knows that the battle of Endor is just a myth fabled by George Lucas for promotion of his movie. Actually, no battle of Endor has happened and the First Galactic Empire prospers to this day....原创 2018-08-13 12:49:48 · 201 阅读 · 0 评论 -
HDU-5685 Problem A(前缀积,逆元,阶乘模)
Problem A Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 2210 Accepted Submission(s): 977 Problem Description 度熊手上有一本...原创 2018-08-03 23:37:38 · 264 阅读 · 0 评论 -
LightOJ-1067 - Combinations(阶乘模 C(n,m)模的逆元处理)
1067 - Combinations PDF (English) Statistics Forum Time Limit: 2 second(s) Memory Limit: 32 MB Given n different objects, you want to take k of them. How many ways to can do it?...原创 2018-08-03 18:53:54 · 248 阅读 · 0 评论 -
P1602 Sramoc问题(广搜处理暴力与同余)
题目描述话说员工们整理好了筷子之后,就准备将快餐送出了,但是一看订单,都傻眼了:订单上没有留电话号码,只写了一个sramoc(k,m)函数,这什么东西?什么意思?于是餐厅找来了资深顾问团的成员,YQ,SC,HQ,经过大量的查阅,大家获得了一些信息,Sramoc ( K , M ) 表示用数字0、1、2…、K-1组成的自然数中能被M整除的最小数。例如 K=2,M=7的时候,Sramoc( 2 ,...原创 2018-07-21 14:26:59 · 546 阅读 · 0 评论 -
HDU-2604 Queuing (矩阵快速幂 + 递推思想 + 通用版 )
HDU-2604 Queuing (矩阵快速幂 + 递推思想 + 通用版 )QueuingTime Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Problem DescriptionQueues and Priority Queues are data structures whic...原创 2018-06-01 22:32:47 · 187 阅读 · 0 评论 -
POJ-3070 Fibonacci (矩阵快速幂)
POJ-3070 Fibonacci (矩阵快速幂)FibonacciTime Limit: 1000MS Memory Limit: 65536K DescriptionIn the Fibonacci integer sequence, F0 = 0, F1 = 1, and Fn = Fn − 1 + Fn − 2 for n ≥ 2. For example, the first te...原创 2018-06-01 09:46:38 · 290 阅读 · 0 评论 -
Chat Group(快速幂)
还有一个规律 :C(n,i+1)=C(n,i)*((n-i+1)/i);杨辉三角 可以直接有2^n的快速幂算出来#include<iostream>#include<string>#include<cstdio>#define mod 1000000007using namespace std;long long extend_gcd(...原创 2018-08-31 21:08:01 · 972 阅读 · 0 评论