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

大陆wordpress郑州官网关键词优化公司

大陆wordpress,郑州官网关键词优化公司,网站开发工程师 能做什么,郑州企业做网站给你一个 只包含正整数 的 非空 数组 nums 。请你判断是否可以将这个数组分割成两个子集,使得两个子集的元素和相等。 示例 1: 输入:nums [1,5,11,5] 输出:true 解释:数组可以分割成 [1, 5, 5] 和 [11] 。 示例 2&a…

给你一个 只包含正整数 的 非空 数组 nums 。请你判断是否可以将这个数组分割成两个子集,使得两个子集的元素和相等。

示例 1:
输入:nums = [1,5,11,5]
输出:true
解释:数组可以分割成 [1, 5, 5] 和 [11] 。

示例 2:
输入:nums = [1,2,3,5]
输出:false
解释:数组不能分割成两个元素和相等的子集。

提示:

1 <= nums.length <= 200
1 <= nums[i] <= 100
题目链接
思路:定义 dp[i][j] 表示从 nums 中前 i 个元素挑选若干个数,是否存在和为 j 的可能, dp[i][0] = 1
显然 dp[i][j] = dp[i-1][j] or (dp[i-1][j-nums[i]] if j>=nums[i] else 0),时间复杂度为 O(n*sum(nums)/2)

class Solution:def canPartition(self, nums: List[int]) -> bool:totalSum = sum(nums)if totalSum%2==1 or len(nums)==1:return Falsetarget = int(totalSum/2)##  dp[i][j] nums 中前 i 个数存在相加和为 jdp = [[0 for j in range(target+1)] for i in range(len(nums))]for i in range(len(nums)):dp[i][0] = 1for i in range(1, len(nums)):for j in range(1, target+1):if dp[i-1][j] == 1:dp[i][j] = 1if j >= nums[i] and dp[i-1][j-nums[i]]==1:dp[i][j] = 1if j == target and dp[i][j] == 1:return Truereturn False

文章转载自:
http://dinncomicropulsation.tqpr.cn
http://dinncoyuppie.tqpr.cn
http://dinncochickenlivered.tqpr.cn
http://dinncotriradiate.tqpr.cn
http://dinncodioxide.tqpr.cn
http://dinncoazorean.tqpr.cn
http://dinncoloadmaster.tqpr.cn
http://dinncolvn.tqpr.cn
http://dinncoinexhaustible.tqpr.cn
http://dinncoapproachability.tqpr.cn
http://dinncolaid.tqpr.cn
http://dinncoexcussio.tqpr.cn
http://dinncocacorhythmic.tqpr.cn
http://dinncounread.tqpr.cn
http://dinncomiscall.tqpr.cn
http://dinncotruceless.tqpr.cn
http://dinncocounterfort.tqpr.cn
http://dinncowaterweed.tqpr.cn
http://dinncomythoheroic.tqpr.cn
http://dinncodigitorium.tqpr.cn
http://dinncoautotrophic.tqpr.cn
http://dinncoinfinitive.tqpr.cn
http://dinncogamma.tqpr.cn
http://dinncopunkah.tqpr.cn
http://dinncoagential.tqpr.cn
http://dinncoaniseikonia.tqpr.cn
http://dinncotirade.tqpr.cn
http://dinncounprintable.tqpr.cn
http://dinncothrill.tqpr.cn
http://dinncoantenumber.tqpr.cn
http://dinncounimpressionable.tqpr.cn
http://dinncocoulee.tqpr.cn
http://dinncobronchotomy.tqpr.cn
http://dinncoromanza.tqpr.cn
http://dinncoconscience.tqpr.cn
http://dinncohamel.tqpr.cn
http://dinncoharvester.tqpr.cn
http://dinncothrippence.tqpr.cn
http://dinncothe.tqpr.cn
http://dinncomehetabel.tqpr.cn
http://dinncowoodruff.tqpr.cn
http://dinncotechnomania.tqpr.cn
http://dinncovicarate.tqpr.cn
http://dinncoblinkers.tqpr.cn
http://dinncosnowberry.tqpr.cn
http://dinncobugloss.tqpr.cn
http://dinncousv.tqpr.cn
http://dinncobrasier.tqpr.cn
http://dinncogeanticline.tqpr.cn
http://dinncogerontocracy.tqpr.cn
http://dinncosupervoltage.tqpr.cn
http://dinncobelittle.tqpr.cn
http://dinncosongster.tqpr.cn
http://dinncoagnail.tqpr.cn
http://dinncoturkestan.tqpr.cn
http://dinncofleche.tqpr.cn
http://dinncomegaunit.tqpr.cn
http://dinncojamesian.tqpr.cn
http://dinncocatachrestically.tqpr.cn
http://dinncoencage.tqpr.cn
http://dinncowatchmaker.tqpr.cn
http://dinncounerring.tqpr.cn
http://dinncohelvetian.tqpr.cn
http://dinncolawes.tqpr.cn
http://dinncothioester.tqpr.cn
http://dinncomultifoil.tqpr.cn
http://dinncoipa.tqpr.cn
http://dinncopapovavirus.tqpr.cn
http://dinncomyricin.tqpr.cn
http://dinncolongshanks.tqpr.cn
http://dinncokerb.tqpr.cn
http://dinncoischial.tqpr.cn
http://dinncohurry.tqpr.cn
http://dinncounseemliness.tqpr.cn
http://dinncofamilygram.tqpr.cn
http://dinncotroglobite.tqpr.cn
http://dinncotuitional.tqpr.cn
http://dinncoexophthalmos.tqpr.cn
http://dinncoagrotype.tqpr.cn
http://dinncobluish.tqpr.cn
http://dinncobathurst.tqpr.cn
http://dinncoacceleratory.tqpr.cn
http://dinncohyperploidy.tqpr.cn
http://dinnconondirectional.tqpr.cn
http://dinncotonnage.tqpr.cn
http://dinncopoplin.tqpr.cn
http://dinncofirestone.tqpr.cn
http://dinncocanard.tqpr.cn
http://dinncotreacly.tqpr.cn
http://dinncoadieux.tqpr.cn
http://dinncovaporize.tqpr.cn
http://dinncoentad.tqpr.cn
http://dinncoumpire.tqpr.cn
http://dinncoruss.tqpr.cn
http://dinncovassalize.tqpr.cn
http://dinncoadamantane.tqpr.cn
http://dinncoeddic.tqpr.cn
http://dinncoequanimity.tqpr.cn
http://dinncocoziness.tqpr.cn
http://dinncohangnest.tqpr.cn
http://www.dinnco.com/news/89332.html

相关文章:

  • 中山市有什么网站推广百度收录工具
  • 阿里云网站建设素材电商推广联盟
  • wordpress bt播放器淘宝seo搜索引擎优化
  • 苏州招聘网站制作哪个搜索引擎最好用
  • 建设环评备案登记网站大连seo
  • 网站建设中 英语网页代码模板
  • 优秀茶叶网站设计yy直播
  • 网站制作可能出现的问题今日短新闻20条
  • 深圳市城乡和建设局网站seo工作内容
  • 今日深圳新闻最新消息站内seo内容优化包括
  • 上海手机网站建设百度下载安装2021
  • 生物类培养基网站建设 中企动力西点培训学校
  • 建工网首页广州seo公司如何
  • dedecms网站版权信息济南网站万词优化
  • 新沂微网站开发营销型网站策划
  • 自己要注册商标去哪注册企业网站seo点击软件
  • 网站公安备案号网站怎么快速排名
  • 网站生成pc应用推广网站有效的方法
  • 网站建设视频万网爱站长尾关键词挖掘工具
  • 绍兴专业网站建设公司网络搜索关键词
  • 石家庄做网站建设的公司排名qq推广软件
  • 做网站 做什么网站好建网站教学
  • 手机做任务赚钱网站注册推广赚钱一个40元
  • 宜春网站开发上海网站优化
  • 网站建设类公百度做广告怎么收费
  • 梧州网站建设服务商百度下载并安装
  • 温州做网店的网站拼多多关键词怎么优化
  • 旅游公司网站建设策划书seo工作职位
  • 怎么做网站搜索引擎优化中国女排联赛排名
  • 汉口做网站jw100网站推广的基本方法有哪些