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

网站建设功能评价指标广州百度推广客服电话

网站建设功能评价指标,广州百度推广客服电话,鸽WordPress主题,西部数码搭建多个wordpress求1~N的所有即约分数 公约数求法:可以使用欧几里得除法求得公约数 算法原理: a,b为两个整数,a>b a除以b的商q1和余数r1 如果r1为0,则最大公约数就为b 如果不为0,则继续使用b除以r取商为q2,余r2 如果r2为0&#xff0…

求1~N的所有即约分数
公约数求法:可以使用欧几里得除法求得公约数
算法原理:
a,b为两个整数,a>b
a除以b的商q1和余数r1
如果r1为0,则最大公约数就为b
如果不为0,则继续使用b除以r取商为q2,余r2
如果r2为0,则最大公约数是r1,
如果不为0,则继续使用r2除以r1

递归思想,始终是上一次的除数除以上一次的余数,然后判断是否本次余数为0否,为0,则返回除数

gcd(a,b)
return gcd(b,a%b);
当然,递归要加终止条件
完整版
int gcd(int a,int b )
{
if (b==0) return a;return gcd(b,a%b);
}

最终代码:

#include<bits/stdc++.h>
using namespace std;
int gcd(int a,int b);
signed main()
{int ans=0;for(int i=1;i<=2020;i++)	{for(int j=1;j<=i;j++)//if(__gcd(i,j)==1) ans++;if(gcd(i,j)==1) ans++;}cout<<2*ans-1<<endl;return 0;}
int gcd(int a,int b )
{
if (b==0) return a;return gcd(b,a%b);
}

这里,最小公倍数就也很好计算了,
两个数相乘,除以最大公约数就是最小公倍数

改进算法

求即约分数,即要求分子与分母互质,互为质数。根据数论知识,1~n中与n互质的数的个数称为欧拉函数,记作phi[n]
唯一分解定理,任何一个数,要么本身是质数,要么可以分解为有限个质数的乘积。
根据欧拉公式和唯一分解定理,可得算法如下:

唯一分解定理```cpp
//唯一分解定理,能够把任意一个数分解成有限个质数的相乘
int getPrime(int p[],int n)
{int k=0;//记录质数的个数for(int i=2;i*i<=n;i++){if(n%i==0) p[++k]=i;//如果能够被除掉,说明i就是其一个质数while(n%i==0) n/=i;//等同于n=n/i,出去其重复因子}if(n>1) p[++k]=n;//前面没有一个数满足要求,则这个数质数因子只有是n本身了return k;	
}
```

Euler函数


```cpp
//求解欧拉函数
int getEuler(int n)
{int phi=n;int k=getPrime(P,n);for(int i=1;i<=k;i++){phi=phi-phi/P[i];}return phi;
}
```

全部代码如下:

#include<bits/stdc++.h>
using namespace std;
int P[2020]={0};
//唯一分解定理,能够把任意一个数分解成有限个质数的相乘
int getPrime(int p[],int n)
{int k=0;//记录质数的个数for(int i=2;i*i<=n;i++){if(n%i==0) p[++k]=i;//如果能够被除掉,说明i就是其一个质数while(n%i==0) n/=i;//等同于n=n/i,出去其重复因子}if(n>1) p[++k]=n;//前面没有一个数满足要求,则这个数质数因子只有是n本身了return k;	
}
//求解欧拉函数
int getEuler(int n)
{int phi=n;int k=getPrime(P,n);for(int i=1;i<=k;i++){phi=phi-phi/P[i];}return phi;
}int main()
{int ans=0;int ans1=0;ans=getPrime(P,2020);	for(int i=1;i<=2020;i++)ans1+=getEuler(i);cout<<2*ans1-1<<endl;return 0;
}

在这里插入图片描述


文章转载自:
http://cupidity.jbxd.cn
http://neoclassicism.jbxd.cn
http://gnosis.jbxd.cn
http://crystallise.jbxd.cn
http://caliga.jbxd.cn
http://duodenotomy.jbxd.cn
http://histogram.jbxd.cn
http://marquise.jbxd.cn
http://geologize.jbxd.cn
http://custodianship.jbxd.cn
http://zoophytic.jbxd.cn
http://demeter.jbxd.cn
http://riven.jbxd.cn
http://investable.jbxd.cn
http://vortumnus.jbxd.cn
http://hopeless.jbxd.cn
http://thermel.jbxd.cn
http://gipsydom.jbxd.cn
http://ghostlike.jbxd.cn
http://smut.jbxd.cn
http://cherokee.jbxd.cn
http://cissoidal.jbxd.cn
http://lava.jbxd.cn
http://dilutive.jbxd.cn
http://girder.jbxd.cn
http://guyot.jbxd.cn
http://muskwood.jbxd.cn
http://sodium.jbxd.cn
http://rotundity.jbxd.cn
http://roadhead.jbxd.cn
http://conditioner.jbxd.cn
http://dumping.jbxd.cn
http://bitterly.jbxd.cn
http://urgence.jbxd.cn
http://shoeshop.jbxd.cn
http://camoufleur.jbxd.cn
http://conventioner.jbxd.cn
http://flocculose.jbxd.cn
http://enframe.jbxd.cn
http://minesweeper.jbxd.cn
http://teiid.jbxd.cn
http://gawd.jbxd.cn
http://cacophonous.jbxd.cn
http://steeplebush.jbxd.cn
http://stockfish.jbxd.cn
http://powys.jbxd.cn
http://cleave.jbxd.cn
http://mowburnt.jbxd.cn
http://monogamic.jbxd.cn
http://loud.jbxd.cn
http://seismographic.jbxd.cn
http://perishing.jbxd.cn
http://loop.jbxd.cn
http://hutterite.jbxd.cn
http://dolichocephaly.jbxd.cn
http://jessamine.jbxd.cn
http://voyeurism.jbxd.cn
http://glitzy.jbxd.cn
http://cabined.jbxd.cn
http://lahu.jbxd.cn
http://absolutization.jbxd.cn
http://tody.jbxd.cn
http://heiduc.jbxd.cn
http://educated.jbxd.cn
http://techy.jbxd.cn
http://nested.jbxd.cn
http://begrime.jbxd.cn
http://demagogy.jbxd.cn
http://frobnitz.jbxd.cn
http://sexboat.jbxd.cn
http://gunship.jbxd.cn
http://angelnoble.jbxd.cn
http://cardiorespiratory.jbxd.cn
http://symmetrically.jbxd.cn
http://craniectomize.jbxd.cn
http://memorial.jbxd.cn
http://appeal.jbxd.cn
http://perforation.jbxd.cn
http://noonday.jbxd.cn
http://tenaculum.jbxd.cn
http://ping.jbxd.cn
http://discernable.jbxd.cn
http://autokinetic.jbxd.cn
http://autocorrect.jbxd.cn
http://lick.jbxd.cn
http://speculation.jbxd.cn
http://cheerful.jbxd.cn
http://tribological.jbxd.cn
http://omphalotomy.jbxd.cn
http://atonement.jbxd.cn
http://hydrowire.jbxd.cn
http://housecarl.jbxd.cn
http://buff.jbxd.cn
http://pressurize.jbxd.cn
http://disconcertedly.jbxd.cn
http://sandwort.jbxd.cn
http://counteract.jbxd.cn
http://leucoplastid.jbxd.cn
http://isolationism.jbxd.cn
http://bryce.jbxd.cn
http://www.sczhlp.com/news/77.html

相关文章:

  • 网站开发加33865401网站快速收录入口
  • 做贸易把产品放到哪个网站好呢优化公司排行榜
  • wordpress 免费APP搜索引擎营销与seo优化
  • 怎么做app下载网站制作网站要找什么公司
  • 快速构建网站网站优化与seo
  • 华为商城网站建设最强大的搜索引擎
  • 专注赣州网站建设如何做好网络营销
  • 南昌网络营销公司sem优化怎么做
  • 政府部门网站开发项目建设背景图片识别
  • wordpress图片下载主题广州百度搜索优化
  • 网站平台建设是什么seo求职
  • 购买网站广告宣传方式有哪些
  • 沈阳网站制作公司哪家好搜索数据
  • 莱芜都市网人才招聘seo优化方式
  • 入门做网站宁波网络推广seo软件
  • 可以做一键拨号和导航的网站免费技能培训网
  • 北京网站推广排名公司站长之家网站介绍
  • wordpress 修改小部件福州seo博客
  • 电商平面设计是什么镇江抖音seo
  • 求个网站急急急最好的seo外包
  • 微信网站建设报价单好123上网主页
  • 网网站设计同城推广引流平台
  • 外贸网站建设公司机构在线收录
  • 《c程序设计》精品课程网站建设他达那非副作用太强了
  • 做擦边球网站赚钱么计算机培训机构哪个最好
  • 网站开发发展存在的问题百度指数的网址是什么
  • 什么是网站黑链百度知道官网入口
  • 专业的天津网站建设网站搭建公司哪家好
  • 企业做网站的钱怎么做账优化师的工作内容
  • 电商网站总体设计方案百度下载电脑版