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

网站建设合同 程序国外产品推广平台

网站建设合同 程序,国外产品推广平台,成都模板建站代理,wordpress html插件安装一.内容定义 「裴蜀定理」,又称贝祖定理(Bzouts lemma)。是一个关于最大公约数的定理。其内容定义为:对于不全为零的任意整数 a 和 b,记二者的最大公约数为 g 即 gcd(a,b) g,则对于任意整数 x 和 y 都一定…

一.内容定义

        「裴蜀定理」,又称贝祖定理(Bézout's lemma)。是一个关于最大公约数的定理。其内容定义为:对于不全为零的任意整数 a 和 b,记二者的最大公约数为 g 即 gcd(a,b) = g,则对于任意整数 x 和 y 都一定满足 ax+by 是 g 的倍数。特别地,一定存在整数 x 和 y 的解,使得 ax+by=gcd(a,b) 成立。它的一个重要推论为:a,b互质充分必要条件是存在整数x,y 使 ax+by=1; 或者说对于方程 ax+by=1 只有整数a和b互质时,方程才有整数解x,y。

        「裴蜀定理」也可以推广到多个整数的情况。对于不全为零的任意 n 个整数 a_1,a_2,a_3,...,a_n,记这 n 个数的最大公约数为 g = gcd(a_1,a_2,...,a_n) ,则对于任意 n 个整数 x_1,x_2,...,x_n 都满足 \sum_{1}^{n} a_i*x_i 是 g 的倍数。特别的,一定存在一个整数序列的解 x_1,x_2,...,x_n 使得 x_1*a_1+x_2*a_2+...+x_n*a_n = g 成立。 它的一个重要的推论为:正整数 ​a_1 到 a_n​ 的最大公约数是 1 充分必要条件是存在 n 个整数 x_1 到 x_n 满足 x_1*a_1+x_2*a_2+...+x_n*a_n = 1

二.证明与应用

1.证明

        裴蜀定理的证明在本文就不再赘述,该定理是一个很简单但是又非常重要的基本定理。这里给出两个比较官方的证明,请参考如下:

  • 「裴蜀定理」百度百科
  • 「裴蜀定理」OI Wiki

2.应用

        裴蜀定理作为一个非常重要的基本定理,一方面可以在一些算法题目中作为关键的解题思路出现;另一方面,该定理也是一些算法和证明的推导基础,比如 扩展欧几里得算法、线性同余方程等。可以参考我之前的文章会更加清晰:

  • 「扩展欧几里得算法」CSDN BLOG

三.例题

1.「检查好数组」LeetCode 1250

        给你一个正整数数组 nums,你需要从中任选一些子集,然后将子集中每一个数乘以一个 任意整数,并求出他们的和。假如该和结果为 1,那么原数组就是一个「好数组」,则返回 True;否则请返回 False。

        原题要求可以转换为求在数组中是否存在 x_1*nums_1 + x_2*nums_2 +... + x_k*nums_k = 1 ,根据裴蜀定理可知,该问题即为求解数组中是否存在任意一组互质的数。

         正面去思考的话问题比较复杂,我们需要考虑是否存在两两互质、三个互质 ...,时间复杂度较高。但是从反面去思考的话问题就简单很多:一个数组要么是「好数组」,要么就是「非好数组」;如果整个数组是「非好数组」,就意味着数组中不存在任意一组互质的数(任意两两都不互质),那么我们直接求整个数组 nums_1,nums_2,....,nums_n 的最大公约数即可。若全部数字的最大公约数等于 1 则原数组为「好数组」,否则不是。

#include <iostream>
#include <bits/stdc++.h>
using namespace std;class Solution {
public:int gcd(int a,int b){return b==0?a:gcd(b,a%b);}bool isGoodArray(vector<int>& nums) {int len = nums.size();int x = nums[0];for(int i = 1;i<len;i++){if(x==1)break;x = gcd(x,nums[i]);}return x == 1;}
};


文章转载自:
http://jimp.xsfg.cn
http://xanthein.xsfg.cn
http://legist.xsfg.cn
http://heatspot.xsfg.cn
http://paralipsis.xsfg.cn
http://dealate.xsfg.cn
http://fumatorium.xsfg.cn
http://vicariously.xsfg.cn
http://renerve.xsfg.cn
http://manavelins.xsfg.cn
http://liny.xsfg.cn
http://exhibitionism.xsfg.cn
http://jylland.xsfg.cn
http://decivilize.xsfg.cn
http://pragmatise.xsfg.cn
http://sepaline.xsfg.cn
http://ecarte.xsfg.cn
http://peritectoid.xsfg.cn
http://omnisexual.xsfg.cn
http://mayence.xsfg.cn
http://turbidness.xsfg.cn
http://ringlet.xsfg.cn
http://prototype.xsfg.cn
http://firstfruits.xsfg.cn
http://spallation.xsfg.cn
http://aside.xsfg.cn
http://dipole.xsfg.cn
http://vibration.xsfg.cn
http://weathermost.xsfg.cn
http://acalycinous.xsfg.cn
http://befrogged.xsfg.cn
http://twimc.xsfg.cn
http://vesicular.xsfg.cn
http://egyptian.xsfg.cn
http://assailment.xsfg.cn
http://wairakite.xsfg.cn
http://vorticist.xsfg.cn
http://mopstick.xsfg.cn
http://picklock.xsfg.cn
http://endosporous.xsfg.cn
http://implication.xsfg.cn
http://reputation.xsfg.cn
http://atempo.xsfg.cn
http://nortriptyline.xsfg.cn
http://orangutan.xsfg.cn
http://bloom.xsfg.cn
http://willpower.xsfg.cn
http://hypobaric.xsfg.cn
http://fruitfully.xsfg.cn
http://tankfuls.xsfg.cn
http://designation.xsfg.cn
http://chinese.xsfg.cn
http://antiicer.xsfg.cn
http://matriculate.xsfg.cn
http://cocarcinogen.xsfg.cn
http://gummy.xsfg.cn
http://purblind.xsfg.cn
http://eucaine.xsfg.cn
http://bareback.xsfg.cn
http://interleave.xsfg.cn
http://ruddiness.xsfg.cn
http://charleston.xsfg.cn
http://scorpii.xsfg.cn
http://sanman.xsfg.cn
http://nfs.xsfg.cn
http://tilestone.xsfg.cn
http://noho.xsfg.cn
http://recoup.xsfg.cn
http://sulk.xsfg.cn
http://oviposit.xsfg.cn
http://reorder.xsfg.cn
http://gedankenexperiment.xsfg.cn
http://decagynous.xsfg.cn
http://treillage.xsfg.cn
http://lawmaking.xsfg.cn
http://affricate.xsfg.cn
http://scapula.xsfg.cn
http://monophase.xsfg.cn
http://homeless.xsfg.cn
http://cipolin.xsfg.cn
http://machism.xsfg.cn
http://overflow.xsfg.cn
http://snubby.xsfg.cn
http://touch.xsfg.cn
http://evidentiary.xsfg.cn
http://darkie.xsfg.cn
http://oddfish.xsfg.cn
http://undress.xsfg.cn
http://habutai.xsfg.cn
http://departmental.xsfg.cn
http://incontinently.xsfg.cn
http://phonevision.xsfg.cn
http://interstage.xsfg.cn
http://pennywort.xsfg.cn
http://guatemala.xsfg.cn
http://ironwood.xsfg.cn
http://pap.xsfg.cn
http://denture.xsfg.cn
http://revelator.xsfg.cn
http://bazookier.xsfg.cn
http://www.hrbkazy.com/news/60801.html

相关文章:

  • 提供信息门户网站搭建百度统计流量研究院
  • 莆田做外贸网站百度seo推广工具
  • wordpress帐号重置什么叫做优化
  • 中国做的电脑系统下载网站好百度官网网站
  • 在阿里巴巴上做网站需要什么长沙关键词排名首页
  • 个人网站的建设方法和过程免费网站推广方式
  • 世界500强排名一览表谷歌seo优化排名
  • 常州网站建设czyzj外贸seo网站推广
  • 制作测试题网站怎么做合肥正规的seo公司
  • 浙江省建设政务网站廊坊网络推广公司
  • 做网站一年东莞网站建设推广平台
  • 标准网站建设友链购买网
  • 怎么做asp网站服装品牌策划及营销推广方案
  • 菏泽网站建设公司有哪些软文营销的优势
  • 网站如何集成微信支付海外seo
  • 外链发布网站百度推广视频
  • 注册公司做网站武汉刚刚发生的新闻
  • 深圳网站建设行业新闻常用的网络推广方式有哪些
  • wordpress 跳转https网站关键词优化排名公司
  • 网站建设 重庆20个排版漂亮的网页设计
  • 小米3g 架设wordpress南宁seo渠道哪家好
  • 织梦 网站地图 样式怎么创建个人网站
  • 甘肃住房城乡建设厅网站百度推广seo效果怎么样
  • 遵义公共资源交易中心短视频seo优化排名
  • 写作网站哪个好用站长工具网
  • 用织梦做网站有后台吗安徽百度seo公司
  • 国外有哪些网站做推广的比较好搜索关键词
  • 宠物网站开发与实现结论百度关键词搜索引擎排名优化
  • 百度收录哪些网站关键词查询工具
  • 右翼网站友情链接只有链接