![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
快速计算技巧
帐下幕僚
我只是一个普普通通的大学学生,我来到这里是想获得我在学校所不能得到的知识。
展开
-
hdu5187 zhx's contest题解(快速幂快速积)
公式: ans=2^n-2;(n!=1) 用快速幂快速积即可求得答案 显然n==1时,ans=n%p 当p=2时,由公式ans必为0(当然n!=1)“`include using namespace std; typedef long long ll; ll quick_multify(ll a,ll b,ll p) { ll res=0; a%=p; b原创 2016-06-11 18:58:37 · 261 阅读 · 0 评论 -
hdu1575 Tr A(矩阵快速幂)题解
先写一个矩阵乘法,然后应用快速幂即可#include <iostream>using namespace std;typedef long long ll;ll arr[11][11],n;void quick_multipy(ll a[][11],int p){ ll nres[11][11]={0}; for(int i=0;i<n;i++) for(原创 2016-06-11 19:54:49 · 256 阅读 · 0 评论 -
hdu1211(RSA)(扩展欧几里得+快速幂+快速乘)
其实题意可以这样理解,已知e,n,F(n),且gcd(e,F(n))=1 求d使得 d*e = 1 mod F(n)。 由扩展欧几里得算法可求出d。 然后给一个整数an,输出 (an)^d (mod n)的对应的字符。(显然快速幂搞定)#include <iostream>#include <stdio.h>#include <algorithm>using namespace st原创 2016-07-01 21:04:10 · 370 阅读 · 0 评论