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

海南住房和城乡建设厅网站百度员工收入工资表

海南住房和城乡建设厅网站,百度员工收入工资表,如何办理网站备案,模板建站有什么优势一、捡石头 292 思路就是: 谁面对4块石头的时候,谁就输(因为每次就是1-3块石头,如果剩下4块石头,你怎么拿,我都能把剩下的拿走,所以你就要想尽办法让对面面对4块石头的倍数, 比如有…

一、捡石头 292

思路就是:

谁面对4块石头的时候,谁就输
(因为每次就是1-3块石头,如果剩下4块石头,你怎么拿,我都能把剩下的拿走,所以你就要想尽办法让对面面对4块石头的倍数,

  • 比如有10块石头,你想办法让对方面对4的倍数,10%4=2,也就是你先手拿走2块
  • 比如有13块石头,你想办法让对方面对4的倍数,13%4=1,也就是你先手拿走1块

但是假如你面对了4的倍数,你铁定输,因为对方也是聪明人。

于是先手能不能赢,就看

class Solution {public boolean canWinNim(int n) {return n % 4 != 0 ;}
}

二、捡石头 Nim 游戏 II 1908

int  nums = [ 1, 5, 8, 6 ]

我和你进行捡石头游戏,假如有4堆石头,
第一堆有1个石头,
第二堆有5个石头,
第三堆有8个石头,
第四堆有6个石头,

每次只能从最前面或者最后面取1堆石头,能否保证先手一定能赢

分析如下:

public static void main(String[] args) {int[] nums = {1, 5, 8, 6};int[] nums2 = {3, 9, 1, 2};int[] nums3 = {1, 1, 1, 1};int[] nums4 = {2, 5, 1, 3, 7, 8, 9, 11};int[] nums5 = {1000,0,10000,2,1};int[] nums6 = {10, 8, 20, 15, 3};int[] nums7 = {1, 1, 1, 10};//        int[] nums0 = {5, 8, 6};
//        System.out.println(firstHandCanScore(nums0));System.out.println(firstHandCanScore(nums));System.out.println(firstHandCanScore(nums2));System.out.println(firstHandCanScore(nums3));System.out.println(firstHandCanScore(nums4));System.out.println(firstHandCanScore(nums5));}private static boolean firstHandCanScore(int[] nums) {WinScoreData winScoreData = process(nums, 0, nums.length - 1);System.out.println(winScoreData.winScore);return winScoreData.winScore > 0;}private static WinScoreData process(int[] nums, int fromIndex, int toIndex) {if (fromIndex == toIndex) {return new WinScoreData(nums, fromIndex, toIndex, nums[fromIndex]);}int startLeft = nums[fromIndex];WinScoreData chooseLeftWinScore = process(nums, fromIndex + 1, toIndex);int leftWinScore = startLeft - chooseLeftWinScore.winScore; // 选左边之后的赢面int startRight = nums[toIndex];WinScoreData chooseRightWinScore = process(nums, fromIndex, toIndex - 1);int rightWinScore = startRight - chooseRightWinScore.winScore; // 选右边之后的赢面int winScore = Math.max(leftWinScore, rightWinScore);return new WinScoreData(nums, fromIndex, toIndex, winScore);}@AllArgsConstructorpublic static class WinScoreData {private int[] nums;private int fromIndex;private int toIndex;private int winScore;}

http://www.hkea.cn/news/604172/

相关文章:

  • 盘龙城做网站推广网站推广
  • 如何做电子书网站域名站长工具
  • 物联网平台有哪些排名优化外包公司
  • 秦皇岛汽车网站制作数字营销工具
  • 培训教育的网站怎么做东莞做网站的联系电话
  • 云南做网站的公司外贸谷歌优化
  • 网页设计学徒培训可试学巢湖seo推广
  • 让顾客心动的句子seo模拟点击软件源码
  • 设计类专业包括哪些kj6699的seo综合查询
  • 手机网站制作哪家好查关键词
  • 米拓企业网站管理系统电商培训机构排名前十
  • 做效果图有哪些网站seo点击排名
  • 网络营销推广网站收录seo推广排名平台有哪些
  • 产品经理如何看待网站开发广州软件系统开发seo推广
  • wordpress 忘记管理员如何做网站seo
  • app和网站哪个有优势淘宝关键词排名
  • wordpress该域名宁波网站seo公司
  • 建购物网站怎么建呀简单的网站建设
  • 江苏省建设教育协会网站首页百度知道合伙人答题兼职入口
  • 做优化的网站平台搭建
  • 做网站需要多久网络推广是什么专业
  • 厦门加盟网站建设线上推广营销
  • 定制网站案例seo搜索引擎优化薪酬
  • 网站制作成功后怎么使用浏览器观看b站视频的最佳设置
  • 一家专门做开网店的网站北京seo专员
  • 专业企业网站搭建服务头条权重查询
  • 去哪儿网站上做民宿需要材料免费的黄冈网站有哪些平台
  • 网站建设网现在推广什么app最挣钱
  • 嘉兴装修公司做网站安装百度到桌面
  • 电商网站特点外贸营销网站建站