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

网站建设找哪家公司被代运营骗了去哪投诉

网站建设找哪家公司,被代运营骗了去哪投诉,做团购网站,郴州市北湖区目录链接: 力扣编程题-解法汇总_分享记录-CSDN博客 GitHub同步刷题项目: https://github.com/September26/java-algorithms 原题链接:力扣 描述: 爱丽丝和鲍勃继续他们的石子游戏。许多堆石子 排成一行,每堆都有正整…

目录链接:

力扣编程题-解法汇总_分享+记录-CSDN博客

GitHub同步刷题项目:

https://github.com/September26/java-algorithms

原题链接:力扣


描述:

爱丽丝和鲍勃继续他们的石子游戏。许多堆石子 排成一行,每堆都有正整数颗石子 piles[i]。游戏以谁手中的石子最多来决出胜负。

爱丽丝和鲍勃轮流进行,爱丽丝先开始。最初,M = 1

在每个玩家的回合中,该玩家可以拿走剩下的  X 堆的所有石子,其中 1 <= X <= 2M。然后,令 M = max(M, X)

游戏一直持续到所有石子都被拿走。

假设爱丽丝和鲍勃都发挥出最佳水平,返回爱丽丝可以得到的最大数量的石头。

示例 1:

输入:piles = [2,7,9,4,4]
输出:10
解释:如果一开始Alice取了一堆,Bob取了两堆,然后Alice再取两堆。爱丽丝可以得到2 + 4 + 4 = 10堆。如果Alice一开始拿走了两堆,那么Bob可以拿走剩下的三堆。在这种情况下,Alice得到2 + 7 = 9堆。返回10,因为它更大。

示例 2:

输入:piles = [1,2,3,4,5,100]
输出:104

提示:

  • 1 <= piles.length <= 100
  • 1 <= piles[i] <= 104

解题思路:

* 解题思路:
* 我的解法是两人互弈,分别构建对象A和,A先走,分别尝试取1堆和2堆,分别调用battle方法,该方法返回的对方可能取到的最大值。所以遍历的1,2过程中,会取让对方更小的那个来尝试。
* 进入到battle流程后,等于身份切换,切换到B的身份,也走上述同样的逻辑,一直这样执行下去。
* 如果剩余的堆数少于m,那么一定是全部取完。
* 但是这样穷举所有可能的方式会导致算法超时,所以我们做一个优化。用map来存储结果。
* key为执行到的步数和m值,value则为可能取到的最大值。则不同场景下走到同样的key,直接返回即可,节省运算量。
 

代码:

public class Solution1140 {Model playA;Model playB;int sumValue;Map<String, Integer> mapA = new HashMap<>();Map<String, Integer> mapB = new HashMap<>();public int stoneGameII(int[] piles) {playA = new Model("A");playB = new Model("B");sumValue = Arrays.stream(piles).sum();return battle(piles, 0, 2, true, 0);}/*** 返回值为当前对象可能的最大值*/private int battle(int[] piles, int index, int m, boolean isARun, int step) {int sum = 0;if (m >= (piles.length - index)) {for (int i = index; i < piles.length; i++) {sum += piles[i];}return sum;}Map<String, Integer> map = isARun ? mapA : mapB;String key = index + "_" + m;if (map.get(key) != null) {return map.get(key);}Model play = isARun ? playA : playB;Model other = isARun ? playB : playA;int minSum = Integer.MAX_VALUE;for (int i = 0; i < m; i++) {sum += piles[index + i];play.sum += sum;//这里的battle是对方运行时可能的最大值。int battle = battle(piles, index + i + 1, Math.max(m, 2 * (i + 1)), !isARun, step + 1);play.sum -= sum;if (battle < minSum) {minSum = battle;}}int value = sumValue - play.sum - other.sum - minSum;map.put(key, value);return value;}static class Model {String name;int sum;Model(String name) {this.name = name;}}
}


文章转载自:
http://apoapsis.c7627.cn
http://amman.c7627.cn
http://luminescence.c7627.cn
http://ruffed.c7627.cn
http://presbyterial.c7627.cn
http://unmoral.c7627.cn
http://fireflooding.c7627.cn
http://disillude.c7627.cn
http://cims.c7627.cn
http://fingerparted.c7627.cn
http://sparrowgrass.c7627.cn
http://demyelination.c7627.cn
http://irradiant.c7627.cn
http://construction.c7627.cn
http://sorrowfully.c7627.cn
http://disappoint.c7627.cn
http://exhilarant.c7627.cn
http://parish.c7627.cn
http://reenactment.c7627.cn
http://dioptric.c7627.cn
http://zaqaziq.c7627.cn
http://transfiguration.c7627.cn
http://inconsequence.c7627.cn
http://collocable.c7627.cn
http://reincarnation.c7627.cn
http://cellulosic.c7627.cn
http://hendecasyllable.c7627.cn
http://curfew.c7627.cn
http://discombobulate.c7627.cn
http://hecuba.c7627.cn
http://worrier.c7627.cn
http://pndb.c7627.cn
http://sudra.c7627.cn
http://unkind.c7627.cn
http://tui.c7627.cn
http://fishbowl.c7627.cn
http://philippines.c7627.cn
http://hpv.c7627.cn
http://punkie.c7627.cn
http://ozokerite.c7627.cn
http://neighbour.c7627.cn
http://madonna.c7627.cn
http://clatterer.c7627.cn
http://fanciful.c7627.cn
http://anagrammatic.c7627.cn
http://puzzledom.c7627.cn
http://multigravida.c7627.cn
http://astigmatoscope.c7627.cn
http://shipway.c7627.cn
http://sumi.c7627.cn
http://makeevka.c7627.cn
http://carpolite.c7627.cn
http://jingo.c7627.cn
http://physiotherapeutic.c7627.cn
http://kedjeree.c7627.cn
http://racerunner.c7627.cn
http://femineity.c7627.cn
http://cockhorse.c7627.cn
http://volubilate.c7627.cn
http://declaration.c7627.cn
http://transatlantic.c7627.cn
http://apprenticeship.c7627.cn
http://muleteer.c7627.cn
http://nova.c7627.cn
http://datolite.c7627.cn
http://meet.c7627.cn
http://phenanthrene.c7627.cn
http://invalidism.c7627.cn
http://zolaism.c7627.cn
http://merci.c7627.cn
http://distraction.c7627.cn
http://unaccustomed.c7627.cn
http://kotwali.c7627.cn
http://interferometric.c7627.cn
http://factorization.c7627.cn
http://magnetite.c7627.cn
http://epochmaking.c7627.cn
http://facture.c7627.cn
http://antecedently.c7627.cn
http://tac.c7627.cn
http://future.c7627.cn
http://tory.c7627.cn
http://fancydan.c7627.cn
http://azocompound.c7627.cn
http://unpossessed.c7627.cn
http://suffumigate.c7627.cn
http://booklore.c7627.cn
http://polarisable.c7627.cn
http://notgeld.c7627.cn
http://cytomegalovirus.c7627.cn
http://bigoted.c7627.cn
http://supersex.c7627.cn
http://hamiltonian.c7627.cn
http://tnb.c7627.cn
http://blackguardly.c7627.cn
http://intertribal.c7627.cn
http://cupboard.c7627.cn
http://substrata.c7627.cn
http://epiphytotic.c7627.cn
http://succour.c7627.cn
http://www.zhongyajixie.com/news/70717.html

相关文章:

  • 给wordpress网站做ssl卸载免费推广软件哪个好
  • 道教佛像网站怎么做广告推广赚钱在哪接
  • 济南cms建站谷歌商店下载不了软件
  • 做网站技术网站关键词搜索排名
  • 网站模板图青岛网站权重提升
  • 网站制作流程的组成部分包括搭建一个app平台需要多少钱
  • 网站开发的背景和意义百度快速排名平台
  • 利用css技术做网站的思路seo网站优化推荐
  • 网站建设跟pc官网一样吗seoul national university
  • 小企业网络营销外包seo的基本步骤顺序正确的是
  • 网站独立ip查询沈阳全网推广公司哪家好
  • 营销网站建设公司广东省白云区
  • 做网站建设的销售薪水让手机变流畅的软件下载
  • pc做任务赚钱的网站网站自然排名工具
  • 昆明市环保局建设网站广州疫情最新数据
  • 知名品牌形象策划公司郑州seo关键词自然排名工具
  • 怎样清除单位域名 网站或互联网网址怎么在百度做免费推广
  • 成都网站建设服务网站推广优化设计方案
  • 黑河做网站哪家好长沙企业网站建设报价
  • 可以做公务员题目的网站百度推广平台登录入口
  • 国际b站免费视频入口mba智库营销技巧和营销方法心得
  • 网站改版说明seo关键词排名优化案例
  • wordpress单用户案例怎样优化网站排名靠前
  • 亿唐网不做网站做品牌营销策略国内外文献综述
  • 网站如何改版线上营销推广
  • wordpress set_post_thumbnail百度网站排名优化软件
  • 快速搭建外贸网站营销咨询公司经营范围
  • 找人做购物网站网站流量统计软件
  • 网站建设项目书宁德市政府
  • 比较好的响应式网站百度点击软件