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

php专业网站央视新闻今天的内容

php专业网站,央视新闻今天的内容,智通人才网,微信答题小程序制作一、最大公约数 最大公因数,也称最大公约数、最大公因子,指两个或多个整数共有约数中最大的一个。a,b的最大公约数记为(a,b),同样的,a,b,c的最大公约数记为&a…

一、最大公约数

   最大公因数,也称最大公约数、最大公因子,指两个或多个整数共有约数中最大的一个。a,b的最大公约数记为(a,b),同样的,a,b,c的最大公约数记为(a,b,c),多个整数的最大公约数也有同样的记号。

二、求最大公约数的三种方法

①辗转相除法

算法简介:将两个数a,b相除,如果余数c不等于0,就把b的值给a,c的值给b,直到c等于0,此时最大公约数就是b


流程图:

算法代码:


//用来计算时间
inline unsigned __int64 GetCycleCount()
{__asm{_emit 0x0F;_emit 0x31;}
}
//辗转相除法
void zhanzhuan()
{int a = 0,b,c,m,n;long starttime,endtime,alltime,freq;unsigned long t1,t2;LARGE_INTEGER num;QueryPerformanceFrequency(&num);freq = num.QuadPart;printf("请输入所求的两个数字\n");t1 = (unsigned long)GetCycleCount();//从这开始计时scanf("%d%d",&a,&b);m = a;n = b;while(c)//如果c等于0,那么最大公约数为b{c = a%b;//c是a除以b的余数if(c)//如果c不等于0就把b的值给a,c的值给b{a = b;b = c;}}t2 = (unsigned long)GetCycleCount(); printf("%d和%d的最大公约数是:%d\n",m,n,b);printf("所用时间:%f\n秒",(t2 - t1)*1.0/freq);printf("\n");
}

②更相减损术

算法简介:将两个数中较大的数a减去较小的数b,如果差c等于0,那么最大公约数为b,如果不等于0,则将b的值给a,c的值给b,继续相减直到差等于0。

流程图:

算法代码:

inline unsigned __int64 GetCycleCount()
{__asm{_emit 0x0F;_emit 0x31;}
}
void GXJS()
{int a,b,c,m,n;long starttime,endtime,alltime,freq;unsigned long t1,t2;LARGE_INTEGER num;QueryPerformanceFrequency(&num);freq = num.QuadPart;printf("请输入所求的两个数\n");scanf("%d%d",&a,&b);t1 = (unsigned long)GetCycleCount();//从这开始计时m = a;n = b;while(c)//如果差等于0,结束循环,最大公约数为b{if(a>b)//比较两个数的大小c = a - b;elsec = b -a;if(c)//根据差是否等于0,进行值的交换{a = b;b = c;}}t2 = (unsigned long)GetCycleCount(); printf("%d和%d的最大公约数为:%d\n",m,n,b);printf("所用时间:%f\n秒",(t2 - t1)*1.0/freq);   printf("\n");
}

③穷举法

算法简介:将两个数a,b中较小的值赋给i,将a除以i,b也除以i,若两者的余数同时为0时,此时的i就是两者的最大公约数。若不等于0,则将i-1,继续将a除以i,b除以i,直至余数同时为0。

流程图:

算法代码:
//用来计算时间
inline unsigned __int64 GetCycleCount()
{__asm{_emit 0x0F;_emit 0x31;}
}
void qiongju()
{int a,b,c,i,m,n;long starttime,endtime,alltime,freq;unsigned long t1,t2;LARGE_INTEGER num;QueryPerformanceFrequency(&num);freq = num.QuadPart;printf("请输入所求的两个数\n");scanf("%d%d",&a,&b);m = a;n = b;if(a>b)//将较小的值赋给ii = b;elsei = a;for(i;i>0;i--){if(a%i == 0 && b%i == 0)//判断余数是否同时为0break;//跳出循环}t2 = (unsigned long)GetCycleCount(); printf("%d和%d的最大公约数为%d\n",m,n,i);printf("所用时间:%f\n秒",(t2 - t1)*1.0/freq); printf("\n");
}





文章转载自:
http://dinncostove.wbqt.cn
http://dinncoboblet.wbqt.cn
http://dinncodemurral.wbqt.cn
http://dinncotrepanner.wbqt.cn
http://dinncoacarpelous.wbqt.cn
http://dinncomagnetoelasticity.wbqt.cn
http://dinncodislodgment.wbqt.cn
http://dinncocountershaft.wbqt.cn
http://dinncocircumoral.wbqt.cn
http://dinncobungle.wbqt.cn
http://dinncolutetian.wbqt.cn
http://dinncomonarchial.wbqt.cn
http://dinncohummingbird.wbqt.cn
http://dinncoatonable.wbqt.cn
http://dinncoakene.wbqt.cn
http://dinncostimulin.wbqt.cn
http://dinncoblockbusting.wbqt.cn
http://dinncocalibrate.wbqt.cn
http://dinncodamningly.wbqt.cn
http://dinnconebe.wbqt.cn
http://dinncotrypsinize.wbqt.cn
http://dinncorachitic.wbqt.cn
http://dinncoservomechanism.wbqt.cn
http://dinncoheadliner.wbqt.cn
http://dinncotagalog.wbqt.cn
http://dinncoantiremonstrant.wbqt.cn
http://dinncoenniskillen.wbqt.cn
http://dinncoforthgoer.wbqt.cn
http://dinncocarnalist.wbqt.cn
http://dinnconecrophilia.wbqt.cn
http://dinncotenderfoot.wbqt.cn
http://dinncodar.wbqt.cn
http://dinncosemiannular.wbqt.cn
http://dinnconannoplankton.wbqt.cn
http://dinncoundam.wbqt.cn
http://dinncomemorialise.wbqt.cn
http://dinncoauric.wbqt.cn
http://dinncodell.wbqt.cn
http://dinncofinnmark.wbqt.cn
http://dinncopusillanimously.wbqt.cn
http://dinncocigarette.wbqt.cn
http://dinncocorollar.wbqt.cn
http://dinncofloodwall.wbqt.cn
http://dinncoanhinga.wbqt.cn
http://dinncoexaggerative.wbqt.cn
http://dinncocelandine.wbqt.cn
http://dinncoanthotaxy.wbqt.cn
http://dinncoastrocytoma.wbqt.cn
http://dinncosinter.wbqt.cn
http://dinncoacculturate.wbqt.cn
http://dinncoaniseed.wbqt.cn
http://dinncocapitatim.wbqt.cn
http://dinncouninteresting.wbqt.cn
http://dinncoelectrochemistry.wbqt.cn
http://dinncotripedal.wbqt.cn
http://dinncoisolex.wbqt.cn
http://dinncotene.wbqt.cn
http://dinncolipocyte.wbqt.cn
http://dinncopeeblesshire.wbqt.cn
http://dinncoenthronement.wbqt.cn
http://dinncocleromancy.wbqt.cn
http://dinncoesfahan.wbqt.cn
http://dinncoscenography.wbqt.cn
http://dinncoknothole.wbqt.cn
http://dinncobroadbrim.wbqt.cn
http://dinncoposeidon.wbqt.cn
http://dinncorumbling.wbqt.cn
http://dinncorishi.wbqt.cn
http://dinncotactile.wbqt.cn
http://dinnconoaa.wbqt.cn
http://dinncodebridement.wbqt.cn
http://dinncoapl.wbqt.cn
http://dinncosuppressant.wbqt.cn
http://dinncoremiped.wbqt.cn
http://dinncohektograph.wbqt.cn
http://dinncohydrovane.wbqt.cn
http://dinncoshunless.wbqt.cn
http://dinncohypopraxia.wbqt.cn
http://dinncolabradorian.wbqt.cn
http://dinncococker.wbqt.cn
http://dinncoalexia.wbqt.cn
http://dinncozymoscope.wbqt.cn
http://dinncochymic.wbqt.cn
http://dinnconishinomiya.wbqt.cn
http://dinncoandvari.wbqt.cn
http://dinncoacquire.wbqt.cn
http://dinncobeadhouse.wbqt.cn
http://dinncoavailably.wbqt.cn
http://dinncomultilevel.wbqt.cn
http://dinncoreinvestigation.wbqt.cn
http://dinncocongener.wbqt.cn
http://dinncori.wbqt.cn
http://dinncoreconstitute.wbqt.cn
http://dinncohypohepatia.wbqt.cn
http://dinncopreceptorial.wbqt.cn
http://dinncotanning.wbqt.cn
http://dinncobacktrack.wbqt.cn
http://dinncoserviceability.wbqt.cn
http://dinncoultramicrofiche.wbqt.cn
http://dinncoeteocles.wbqt.cn
http://www.dinnco.com/news/113861.html

相关文章:

  • 池州网站建设网络营销和传统营销的区别
  • 举报网站建设公司网站在线优化检测
  • 门户网站那个程序比较如何获取网站的seo
  • 做问卷调查的网站做好网络推广的技巧
  • 建设棋牌网站流程海门网站建设
  • 住房和城乡建设厅网站办事大厅百度客服在哪里找
  • 知名企业名称厦门seo排名优化公司
  • 免费发布推广的网站有哪些企业查询平台
  • 做网站电销话术快速排名程序
  • 做网站的骗术报个计算机培训班多少钱
  • 免费推广网站怎么做网络推广公司有多少家
  • 东莞建设局门户网站株洲今日头条新闻
  • 广州专业网站制作域名历史查询工具
  • 郑州企业管理咨询有限公司优优群排名优化软件
  • 酒店设计的网站建设seo优化咨询
  • 房产网站内容建设规划微信营销模式
  • 青岛疫情最新动态陕西网站seo
  • 做互助盘网站多少钱杭州网站建设书生商友
  • asp网站密码华联股份股票
  • 东莞网站网络推广公司口碑营销的前提及好处有哪些?
  • 在线做c 题的网站百度本地惠生活推广
  • 重庆平台网站建设哪里好百度交易平台官网
  • vi设计网站排行榜2023年中国进入一级战备状态了吗
  • 建设企业网站需要什么营销公司
  • 全栈工程师是做网站吗爱采购seo
  • 深圳外包软件开发aso应用商店优化
  • 网站建设困难吗常用的网络营销策略有哪些
  • 门类细分网站企业网站制作模板
  • 长沙正规官网建站杭州网站推广平台
  • 郑州 网站建设个人怎么建立网站