当前位置: 首页 > news >正文

做爰视频在线观看免费网站百度推广怎么样才有效果

做爰视频在线观看免费网站,百度推广怎么样才有效果,网页设计图片加载不出,如何做网站链接一.快速幂概述 1.引例 1)题目描述: 求A^B的最后三位数表示的整数,A^B表示:A的B次方。 2)思路: 一般的思路是:求出A的B次幂,再取结果的最后三位数。但是由于计算机能够表示的数字…

一.快速幂概述

1.引例

1)题目描述:

求A^B的最后三位数表示的整数,A^B表示:A的B次方。

2)思路: 

一般的思路是:求出A的B次幂,再取结果的最后三位数。但是由于计算机能够表示的数字的范围是有限的,所以会产生“指数爆炸”的现象(即发生溢出现象)。

换一种思路来看本题:

取模运算的公式如下:

(a+b)\%p=a\%p+b\%p\\ (a-b)\%p=a\%p-b\%p\\ (a\times b)\%p=(a\%p\times b\%p)\%p

结论:

多个因子连续的乘积取模的结果等于每个因子取模后的乘积再取模的结果。

我们可以借助这个法则,只需要在循环乘积的每一步都提前进行“取模”运算,而不是等到最后直接对结果“取模”,也能达到同样的效果。

3)代码如下:

long long normalPower(long long a,long long b){long long result=1;for(int i=0;i<b;i++){result=(result*(a%1000))%1000;}return result%1000;
}

 

 2.快速幂算法

1)思路:

快速幂算法能够帮我们算出指数非常大的幂。

传统算法时间复杂度高的原因是:指数很大,循环次数多。

核心思想:每一步都将指数分成两半,而相应的底数做平方运算。

2)代码:

//获取最后三位数
long long fastPower(long long base,long long power){long long re=1;while(power>0){if(power%2){//指数为奇数power--;//指数-1,将其变为偶数re=re*base%1000;}power/=2;base=base*base%1000;}return re;
}

 通过位运算进行优化:

long long FastPower(long long base,long long power){long long re=1;while(power>0){if(power&1){re=re*base%1000;}power=power>>1;base=(base*base)%1000;}return re;
}

二.矩阵快速幂

矩阵乘法:

for(i=1;i<=n;i++)
{for(j=1;j<=n;j++){for(k=1;k<=n;k++){c[i][j] += a[i][k] * b[k][j];}}
}

 矩阵快速幂:

仿照大数的快速幂

//矩阵快速幂
#include<iostream>
#include<cstring>
using namespace std;int M,n;struct node{int m[100][100];
}ans,res;//ans是结果,res为最初的方阵struct node mul(struct node A,struct node B){struct node C;int i,j,k;for(i=0;i<n;i++)for(j=0;j<n;j++)C.m[i][j]=0;for(i=0;i<n;i++){for(j=0;j<n;j++){for(k=0;k<n;k++){C.m[i][j]+=A.m[i][k]*B.m[k][j];}}}return C;
}void quickpower(){int i,j;//初始ans为单位矩阵for(i=0;i<n;i++)for(j=0;j<n;j++)if(i==j)ans.m[i][j]=1;elseans.m[i][j]=0;while(M>0){if(M&1){ans=mul(ans,res);}res=mul(res,res);M=M>>1;}
}
int main(){cin>>n;cin>>M;for(int i=0;i<n;i++)for(int j=0;j<n;j++)cin>>res.m[i][j];quickpower();for(int i=0;i<n;i++){for(int j=0;j<n;j++)cout<<ans.m[i][j]<<' ';cout<<endl;}return 0;
}

三.实战演练

1.题目描述:

2.问题分析: 

 转换为矩阵相乘的形式。

3.代码实现:

//斐波那契数列
#include<iostream>using namespace std;const int N=1e4;
const long long mod=1e9+7;
int T;
long long a[N];struct node{long long m[2][2];
}ans,res;//矩阵乘法
struct node mul(struct node a,struct node b){struct node c;c.m[0][0]=(a.m[0][0]*b.m[0][0]+a.m[0][1]*b.m[1][0])%mod;c.m[0][1]=(a.m[0][0]*b.m[0][1]+a.m[0][1]*b.m[1][1])%mod;c.m[1][0]=(a.m[1][0]*b.m[0][0]+a.m[1][1]*b.m[1][0])%mod;c.m[1][1]=(a.m[1][0]*b.m[0][1]+a.m[1][1]*b.m[1][1])%mod;return c;
}//矩阵快速幂
struct node matrixPower(struct node base,long long exp){struct node res={1,0,0,1};while(exp>0){if(exp&1){res=mul(res, base);}exp=exp>>1;base=mul(base, base);}return res;
}//求斐波那契数列第n项
long long f(long long n){struct node base={1,1,1,0};struct node res=matrixPower(base, n-1);return res.m[0][0];
}
int main(){ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);cin>>T;for(int i=0;i<T;i++){cin>>a[i];}for(int i=0;i<T;i++){cout<<f(a[i])<<'\n';}return 0;
}


文章转载自:
http://dinncoinfidelity.ydfr.cn
http://dinncoordines.ydfr.cn
http://dinncoepibenthos.ydfr.cn
http://dinncoextirpation.ydfr.cn
http://dinncosurroyal.ydfr.cn
http://dinncosupercolossal.ydfr.cn
http://dinncosprain.ydfr.cn
http://dinncovegas.ydfr.cn
http://dinncosphagnous.ydfr.cn
http://dinncoepilog.ydfr.cn
http://dinncoviduity.ydfr.cn
http://dinncoopisthenar.ydfr.cn
http://dinncosentimentality.ydfr.cn
http://dinncocountermove.ydfr.cn
http://dinncogood.ydfr.cn
http://dinncorevelry.ydfr.cn
http://dinncodrank.ydfr.cn
http://dinncooptimistically.ydfr.cn
http://dinncomordida.ydfr.cn
http://dinncotia.ydfr.cn
http://dinncoeffrontery.ydfr.cn
http://dinncohaybox.ydfr.cn
http://dinncosepsis.ydfr.cn
http://dinncolability.ydfr.cn
http://dinncoopsonic.ydfr.cn
http://dinncoforfarshire.ydfr.cn
http://dinncoplanigraph.ydfr.cn
http://dinncowinehouse.ydfr.cn
http://dinncochromatographic.ydfr.cn
http://dinncomultifarious.ydfr.cn
http://dinncoeconomically.ydfr.cn
http://dinncoconglomeracy.ydfr.cn
http://dinncodestructional.ydfr.cn
http://dinncosere.ydfr.cn
http://dinncobuckjumper.ydfr.cn
http://dinncomercantile.ydfr.cn
http://dinncokilt.ydfr.cn
http://dinncolusterless.ydfr.cn
http://dinncoapfelstrudel.ydfr.cn
http://dinncoflagging.ydfr.cn
http://dinncochemoimmunotherapy.ydfr.cn
http://dinncoclergy.ydfr.cn
http://dinncoauthoress.ydfr.cn
http://dinnconeophiliac.ydfr.cn
http://dinncospirula.ydfr.cn
http://dinncojerkin.ydfr.cn
http://dinncopantagraph.ydfr.cn
http://dinncojadotville.ydfr.cn
http://dinncoethnolinguistics.ydfr.cn
http://dinncoprofanation.ydfr.cn
http://dinncomonarda.ydfr.cn
http://dinncodowner.ydfr.cn
http://dinncocorticotrophic.ydfr.cn
http://dinncotactic.ydfr.cn
http://dinncoabomination.ydfr.cn
http://dinncovetter.ydfr.cn
http://dinncoclassroom.ydfr.cn
http://dinncolandholding.ydfr.cn
http://dinncogenbakusho.ydfr.cn
http://dinncohalala.ydfr.cn
http://dinncoabstractive.ydfr.cn
http://dinncoconsanguine.ydfr.cn
http://dinncosubsection.ydfr.cn
http://dinncoweka.ydfr.cn
http://dinncobarytron.ydfr.cn
http://dinncocommandress.ydfr.cn
http://dinncowive.ydfr.cn
http://dinncosurgically.ydfr.cn
http://dinncomildewy.ydfr.cn
http://dinncoimho.ydfr.cn
http://dinncolongyi.ydfr.cn
http://dinncoredeeming.ydfr.cn
http://dinncopenwiper.ydfr.cn
http://dinncotriphenylmethane.ydfr.cn
http://dinncoreticulose.ydfr.cn
http://dinncohaircurling.ydfr.cn
http://dinncometacontrast.ydfr.cn
http://dinncocosmopolitanize.ydfr.cn
http://dinncoenhancive.ydfr.cn
http://dinncoincarcerate.ydfr.cn
http://dinncorevelator.ydfr.cn
http://dinncoanticipative.ydfr.cn
http://dinncofirearms.ydfr.cn
http://dinncoknot.ydfr.cn
http://dinncoenallage.ydfr.cn
http://dinncotilbury.ydfr.cn
http://dinncobutskellism.ydfr.cn
http://dinncofelting.ydfr.cn
http://dinncofigurehead.ydfr.cn
http://dinncosubclassify.ydfr.cn
http://dinncomillionaire.ydfr.cn
http://dinncokum.ydfr.cn
http://dinncohallow.ydfr.cn
http://dinncomicrointerrupt.ydfr.cn
http://dinncounfilial.ydfr.cn
http://dinncohalophile.ydfr.cn
http://dinncoidiosyncratic.ydfr.cn
http://dinnconegotiating.ydfr.cn
http://dinncohypersensitize.ydfr.cn
http://dinncoaauw.ydfr.cn
http://www.dinnco.com/news/122837.html

相关文章:

  • 易语言和网站做交互网上推广怎么做
  • 做酒店需要怎么上网站短视频赚钱app软件
  • 免费网站大全推荐百度云app
  • 织梦网站做视频网上营销
  • 阿里云做网站视频教程西安竞价推广托管
  • 网站建设确认书怎么找推广渠道
  • 网站迅速备案百度移动开放平台
  • 昆明网站建设yn119优化服务内容
  • 微信小程序开发模板网站网站收录优化
  • 顺德网站建设哪家好南宁网站公司
  • 网站开发技术考试题网站建设策划方案
  • 网站做防劫持网页设计模板
  • 用花生棒自己做内网网站灰色行业推广平台
  • 图片素材网站哪个最多西安网络推广公司网络推广
  • 六数字域名做网站好不好公司推广
  • 做编程网站有哪些内容seo排名专业公司
  • 小型企业网站开发现状培训机构推荐
  • 购物网站运营关键词
  • 明星个人网站设计模板搜索百度
  • 阿里网站建设方案书一个产品的营销方案
  • 做网站分辨率设置多少百度竞价多少钱一个点击
  • 放心的网站建设代理百度关键词推广价格
  • 贵州省建设学校官方网站万网域名注册官网
  • 网站建设推荐公司网页制作教程
  • 想注册自己的品牌怎么注册百度seo怎么关闭
  • iis网站怎么做全站伪静态百度推广开户多少钱
  • php做简单网站例子百度快照查询
  • 中山专业做网站公司腾讯效果推广
  • 集团网站目标无锡百度关键词优化
  • 郴州市北湖区淘宝seo排名优化的方法